void setup()
{
pinMode(1,OUTPUT);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
}
void loop()
{
int i;
// 1st pattern
for(i=1; i<=5; i++)
{
digitalWrite(i,HIGH);
delay(50);
digitalWrite(i,LOW);
delay(50);
}
for(i=10; i>=1; i--)
{
digitalWrite(i,HIGH);
delay(50);
digitalWrite(i,LOW);
delay(50);
}
delay(500);
//2nd pattern
for(i=1; i<=10 ; i++)
{
digitalWrite(i,HIGH);
delay(50);
}
for(i=1; i<=10 ; i++)
{
digitalWrite(i,LOW);
delay(50);
}
for(i=10; i>=1 ; i--)
{
digitalWrite(i,HIGH);
delay(50);
}
for(i=10; i>=1 ; i--)
{
digitalWrite(i,LOW);
delay(50);
}
delay(500);
//3rd pattern
for(i=1; i<=10 ; i++)
{
digitalWrite(i,HIGH);
delay(50);
}
for(i=11; i>=1 ; i--)
{
digitalWrite(i,LOW);
delay(50);
}
for(i=10; i>=1 ; i--)
{
digitalWrite(i,HIGH);
delay(50);
}
for(i=1; i<=10 ; i++)
{
digitalWrite(i,LOW);
delay(50);
}
delay(500);
//4th pattern
for(i=1; i<=5 ; i++)
{
digitalWrite(i,HIGH);
digitalWrite(11-i,HIGH);
delay(100);
}
for(i=1; i<=5 ; i++)
{
digitalWrite(i,LOW);
digitalWrite(11-i,LOW);
delay(100);
}
delay(100);
for(i=1; i<=5 ; i++)
{
digitalWrite(i,HIGH);
digitalWrite(11-i,HIGH);
delay(100);
}
for(i=5; i>=1 ; i--)
{
digitalWrite(i,LOW);
digitalWrite(11-i,LOW);
delay(100);
}
delay(500);
//5th pattern
for(i=1 ; i<=3 ; i++)
{
digitalWrite(i,HIGH);
digitalWrite(i+3,HIGH);
digitalWrite(i+6,HIGH);
delay(500/i);
}
delay(500);
for(i=1 ; i<=3 ; i++)
{
digitalWrite(i,LOW);
digitalWrite(i+3,LOW);
digitalWrite(i+6,LOW);
delay(500/i);
}
delay(500);
}
Comments