int LEDs[] = {23,22,19,18};
#define Button1 32 #define Button2 33 #define Button3 34 #define Button4 35
#define UP 0 #define DOWN 1
#define ON HIGH #define OFF LOW
unsigned char Button_State;
void setup() { unsigned char i; for (i=0; i<=3; i++) { pinMode(LEDs[i], OUTPUT); digitalWrite(LEDs[i],OFF); }
pinMode(Button1, INPUT);
pinMode(Button2, INPUT);
pinMode(Button3, INPUT);
pinMode(Button4, INPUT);
}
void loop() {
unsigned char j; //LED 0: Rear Right //LED 1: Front Right //LED 2: Front Left //LED 3: Rear Left
delay(500); digitalWrite(LEDs[1],ON); digitalWrite(LEDs[2],ON); delay(500); digitalWrite(LEDs[1],OFF); digitalWrite(LEDs[2],OFF); delay(1000);
Button_State = digitalRead(Button1);
if(Button_State == UP) { //Do nothing } else if(Button_State == DOWN) { digitalWrite(LEDs[0],ON); digitalWrite(LEDs[3],ON); delay(500); digitalWrite(LEDs[0],OFF); digitalWrite(LEDs[3],OFF); delay(500); digitalWrite(LEDs[0],ON); digitalWrite(LEDs[2],ON); delay(500); digitalWrite(LEDs[0],OFF); digitalWrite(LEDs[2],OFF);
}
Button_State = digitalRead(Button2);
if(Button_State == UP) { //Do nothing } else if(Button_State == DOWN) { digitalWrite(LEDs[0],ON); digitalWrite(LEDs[3],ON); delay(500); digitalWrite(LEDs[0],OFF); digitalWrite(LEDs[3],OFF); delay(500); digitalWrite(LEDs[0],ON); digitalWrite(LEDs[2],ON); delay(500); digitalWrite(LEDs[0],OFF); digitalWrite(LEDs[2],OFF);
}
Button_State = digitalRead(Button3); if(Button_State == UP) { //Do nothing } else if(Button_State == DOWN) { digitalWrite(LEDs[0],ON); digitalWrite(LEDs[3],ON); delay(500); digitalWrite(LEDs[0],OFF); digitalWrite(LEDs[3],OFF); delay(500); digitalWrite(LEDs[0],ON); digitalWrite(LEDs[2],ON); delay(500); digitalWrite(LEDs[0],OFF); digitalWrite(LEDs[2],OFF);
}
Button_State = digitalRead(Button4);
if(Button_State == UP) { //Do nothing } else if(Button_State == DOWN) { digitalWrite(LEDs[0],ON); digitalWrite(LEDs[3],ON); delay(500); digitalWrite(LEDs[0],OFF); digitalWrite(LEDs[3],OFF); delay(500); digitalWrite(LEDs[0],ON); digitalWrite(LEDs[2],ON); delay(500); digitalWrite(LEDs[0],OFF); digitalWrite(LEDs[2],OFF);
} }