int t = 40;
int rnd =5;
int pat1t =75;
void setup()
{
for(int i=3; i<=12; i++)
pinMode(i,OUTPUT);
}
void loop(){
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();}
}
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);
}
}
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);
}
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);
}
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);
}
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);
}
}