// Code by Silvana Espinoza, Fab Academy 2024 const int LedPin = D0; // Assigns the LED pin number 0 to the variable LedPin const int LedPin2 = D6; // Assigns the LED pin number 6 to the variable LedPin2 const int LedPin3 = D7; // Assigns the LED pin number 7 to the variable LedPin3 const int button = D1; // Assigns the pushbutton pin number 1 to the variable button int buttonState = 0; // Initializes a variable for reading the pushbutton status void setup() { Serial.begin(9600); // Initializes serial communication with a baud rate of 9600 pinMode(button, INPUT); // Configures the pushbutton pin as INPUT pinMode(LedPin, OUTPUT); // Configures LedPin as OUTPUT pinMode(LedPin2, OUTPUT); // Configures LedPin2 as OUTPUT pinMode(LedPin3, OUTPUT); // Configures LedPin3 as OUTPUT } void loop() { buttonState = digitalRead(button); // Reads the current state of the pushbutton and stores it in buttonState if (buttonState == HIGH) { for (int i = 0; i <= 5; i++) // Executes the following code block 6 times { delay(800); digitalWrite(LedPin, HIGH); // Turns on LedPin delay(600); digitalWrite(LedPin, LOW); // Turns off LedPin delay(800); digitalWrite(LedPin2, HIGH); // Turns on LedPin2 delay(600); digitalWrite(LedPin2, LOW); // Turns off LedPin2 delay(800); digitalWrite(LedPin3, HIGH); // Turns on LedPin3 delay(500); digitalWrite(LedPin3, LOW); // Turns off LedPin3 } } else { digitalWrite(LedPin, LOW); // Turns off LedPin digitalWrite(LedPin2, LOW); // Turns off LedPin2 digitalWrite(LedPin3, HIGH); // Turns on LedPin3 } }