#include <Servo.h>
Servo Serv1;
Servo Serv2;
int pinServo1=3;
int pinServo2=5;
int t = 40;
int rnd =5;
int pat1t =75;
void setup(){
Serv1.attach(pinServo1);
Serv2.attach(pinServo2);
pinMode(9, OUTPUT);
for(int i=3; i<=12; i++)
pinMode(i,OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop(){
Serv1.write(20);
Serv2.write(20);
delay(1000);
Serv1.write(160);
Serv2.write(160);
delay(1000);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
tone(9,1000);
delay(1000);
tone(9,500);
delay(1000);
tone(9,250);
delay(1000);
for(int i=0; i<=rnd; i++) {
pat1();}
for(int i=0; i<=rnd; i++){
pat2();}
for(int i=0; i<=rnd; i++) {
pat3();}
for(int i=0; i<=rnd; i++) {
pat4();}
for(int i=0; i<=rnd; i++){
pat5();}
for(int i=0; i<=rnd; i++) {
pat6();}
for(int i=0; i<=rnd; i++) {
pat7();}
for(int i=0; i<=rnd; i++) {
pat8();}
for(int i=0; i<=rnd; i++) {
pat9();}
}
digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
void pat1(){
for(int i=3; i<=12; i++) {
digitalWrite(i,HIGH);
delay(pat1t);
digitalWrite(i,LOW);
}
for(int i=11; i>=4; i--) {
digitalWrite(i,HIGH);
delay(pat1t);
digitalWrite(i,LOW);
}
}
void pat2(){
for(int i=3; i<=12; i++) {
digitalWrite(i,HIGH);
digitalWrite(i-1,HIGH);
digitalWrite(i+1,HIGH);
delay(100);
digitalWrite(i,LOW);
digitalWrite(i-1,LOW);
digitalWrite(i+1,LOW);
}
for(int i=11; i>=4; i--) {
digitalWrite(i,HIGH);
digitalWrite(i-1,HIGH);
digitalWrite(i+1,HIGH);
delay(100);
digitalWrite(i,LOW);
digitalWrite(i-1,LOW);
digitalWrite(i+1,LOW);
}
}
digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
void pat3(){
for(int i=3; i<=12; i=i+2) {
digitalWrite(i,HIGH);
delay(100);
digitalWrite(i,LOW);
}
for(int i=12; i>=3; i=i-2) {
digitalWrite(i,HIGH);
delay(100);
digitalWrite(i,LOW);
}
}
void pat4(){
for(int i=3; i<=12; i++) {
digitalWrite(i,HIGH);
delay(100);
}
for(int i=12; i>=2; i--) {
digitalWrite(i,HIGH);
delay(100);
digitalWrite(i,LOW);
}
}
void pat5(){
for(int i=3; i<=12; i++) {
digitalWrite(i,HIGH);
}
delay(100);
for(int i=3; i<=12; i++) {
digitalWrite(i,LOW);
}
delay(100);
}
digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
void pat6(){
for(int i=3; i<=8; i++) {
digitalWrite(i,HIGH);
}
for(int i=8; i<=12; i++) {
digitalWrite(i,LOW);
}
delay(200);
for(int i=3; i<=8; i++) {
digitalWrite(i,LOW);
}
for(int i=8; i<=12; i++) {
digitalWrite(i,HIGH);
}
delay(200);
}
void pat7(){
for(int i=3; i<=12; i=i+2) {
digitalWrite(i,HIGH);
}
digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
for(int i=4; i<=12; i=i+2) {
digitalWrite(i,LOW);
}
delay(200);
for(int i=3; i<=12; i=i+2) {
digitalWrite(i,LOW);
}
for(int i=4; i<=12; i=i+2) {
digitalWrite(i,HIGH);
}
delay(200);
}
void pat8(){
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
delay(t);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
delay(t);
digitalWrite(6,HIGH);
digitalWrite(9,HIGH);
delay(t);
digitalWrite(6,LOW);
digitalWrite(9,LOW);
delay(t);
digitalWrite(5,HIGH);
digitalWrite(10,HIGH);
delay(t);
digitalWrite(5,LOW);
digitalWrite(10,LOW);
delay(t);
digitalWrite(4,HIGH);
digitalWrite(11,HIGH);
delay(t);
digitalWrite(4,LOW);
digitalWrite(11,LOW);
delay(t);
digitalWrite(3,HIGH);
digitalWrite(12,HIGH);
delay(t);
digitalWrite(3,LOW);
digitalWrite(12,LOW);
delay(t);
digitalWrite(4,HIGH);
digitalWrite(11,HIGH);
delay(t);
digitalWrite(4,LOW);
digitalWrite(11,LOW);
delay(t);
digitalWrite(5,HIGH);
digitalWrite(10,HIGH);
delay(t);
digitalWrite(5,LOW);
digitalWrite(10,LOW);
delay(t);
digitalWrite(6,HIGH);
digitalWrite(9,HIGH);
delay(t);
digitalWrite(6,LOW);
digitalWrite(9,LOW);
delay(t);
}
digitalWrite(10, HIGH);
delay(125);
digitalWrite(11, HIGH);
delay(125);
digitalWrite(12, HIGH);
delay(125);
digitalWrite(13, HIGH);
delay(125);
digitalWrite(10, LOW);
delay(125);
digitalWrite(11, LOW);
delay(125);
digitalWrite(12, LOW);
delay(125);
digitalWrite(13, LOW);
delay(125);
void pat9(){
for(int i=3; i<=12; i++) {
digitalWrite(i,HIGH);
}
for(int i=3; i<=12; i++) {
digitalWrite(i,LOW);
delay(100);
digitalWrite(i,HIGH);
}
for(int i=11; i>=4; i--) {
digitalWrite(i,LOW);
delay(100);
digitalWrite(i,HIGH);
}
}