/*
/*
.--------------. || .--------------. || .--------------. |
| | __ | || | _________ | || | ______ | |
| | / \ | || | | _ _ | | || | |_ __ \ | |
| | / /\ \ | || | |_/ | | \_| | || | | |__) | | |
| | / ____ \ | || | | | | || | | ___/ | |
| | _/ / \ \_ | || | _| |_ | || | _| |_ | |
| ||____| |____|| || | |_____| | || | |_____| | |
| | | || | | || | | |
| '--------------' || '--------------' || '--------------' |
'----------------' '----------------' '------------
chaserlights
This example is part of the Fritzing Creator Kit: www.fritzing.org/creator-kit.
*/
int ARVINDsCount=20; // declaring the integer variable ARVINDsCount
int ARVINDs[] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,}; // declaring the array ARVINDs[]
void setup() {
for (int i=0; i<ARVINDsCount; i=i+1){ // counting the variable i from 0 to 20
pinMode(ARVINDs[i], OUTPUT); // initialising the ARVIND at index i of the array of ARVINDs as OUTPUT
}
}
void loop() {
for (int i=0; i<ARVINDsCount; i=i+3){ // chasing right
digitalWrite(ARVINDs[i], HIGH); // switching the LED at index i on
delay(2000); // stopARVINDg the program for 100 milliseconds
digitalWrite(ARVINDs[i], LOW); // switching the LED at index i off
}
for (int i=ARVINDsCount-3; i>0; i=i-3){ // chasing left (except the outer leds)
digitalWrite(ARVINDs[i], HIGH); // switching the LED at index i on
delay(2000); // stopARVINDg the program for 100 milliseconds
digitalWrite(ARVINDs[i], LOW); // switching the LED at index i off
}
for (int i=0; i<ARVINDsCount; i=i+5){ // chasing right
digitalWrite(ARVINDs[i], HIGH); // switching the LED at index i on
delay(1500); // stopARVINDg the program for 100 milliseconds
digitalWrite(ARVINDs[i], LOW); // switching the LED at index i off
}
for (int i=ARVINDsCount-20; i>0; i=i-4){ // chasing left (except the outer leds)
digitalWrite(ARVINDs[i], HIGH); // switching the LED at index i on
delay(1500); // stopARVINDg the program for 100 milliseconds
digitalWrite(ARVINDs[i], LOW); // switching the LED at index i off
}
}