const int lowestPin = 2;
const int highestPin = 9;
void setup() {
// put your setup code here, to run once:
for (int thisPin = lowestPin; thisPin <= highestPin; thisPin++) {
pinMode(thisPin, OUTPUT);
}
}
void led_Right_to_Left(){
for (int thisPin = lowestPin; thisPin <= highestPin; thisPin++) {
digitalWrite(thisPin, 1);
delay(200);
}
for (int thisPin = highestPin; thisPin >= lowestPin; thisPin--) {
digitalWrite(thisPin, 0);
delay(200);
}
}
void led_Left_to_Right(){
for (int thisPin = highestPin; thisPin >= lowestPin; thisPin--) {
digitalWrite(thisPin, 1);
delay(200);
}
for (int thisPin = lowestPin; thisPin <= highestPin; thisPin++) {
digitalWrite(thisPin, 0);
delay(200);
}
}
void loop() {
// put your main code here, to run repeatedly:
led_Right_to_Left();
led_Left_to_Right();
}