int buttonState;
int pushbutton = 2;
byte ledFirst = 12;
byte ledSecond = 11;
byte ledThird = 10;
long randomNum;
void setup() {
// put your setup code here, to run once:
pinMode(pushbutton, INPUT);
pinMode(ledFirst, OUTPUT);
pinMode(ledSecond, OUTPUT);
pinMode(ledThird, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
buttonState = digitalRead(pushbutton);
(buttonState) ? lightTheBeacons() : ledOFF();
}
void lightTheBeacons() {
digitalWrite(ledFirst, HIGH);
delay(1000);
digitalWrite(ledSecond, HIGH);
delay(1000);
digitalWrite(ledThird, HIGH);
delay(1000);
shutItOff();
}
void shutItOff() {
digitalWrite(ledFirst, LOW);
delay(1000);
digitalWrite(ledSecond, LOW);
delay(1000);
digitalWrite(ledThird, LOW);
}
void ledOFF() {
digitalWrite(ledFirst, LOW);
digitalWrite(ledSecond, LOW);
digitalWrite(ledThird, LOW);
}