int pushbutton1 = 2;
int pushbutton2 = 3;
int led[5]={4,5,6,7,8};
void setup()
{
for(int i=0; i<=4; i++) {pinMode(led[i], OUTPUT);}
pinMode(pushbutton1, INPUT);
pinMode(pushbutton2, INPUT);
}
void loop()
{
pushbutton1 = digitalRead(2);
pushbutton2 = digitalRead(3);
if (pushbutton1 == HIGH)
{
for(int i=0; i<=4; i++) {digitalWrite(led[i],HIGH); delay(200);}
for(int i=0; i<=4; i++) {digitalWrite(led[i],LOW);}
}
if (pushbutton2 == HIGH)
{
for(int i=4; i>=0; i--) {digitalWrite(led[i],HIGH); delay(200);}
for(int i=4; i>=0; i--) {digitalWrite(led[i],LOW);}
}
}