const int ledPin = D0; // the number of the LED pin const int ledPin1 = D6; // the number of the LED pin const int ledPin2 = D7; // the number of the LED pin const int buttonPin = D1; // the number of the pushbutton pin int buttonState = 0; // variable for reading the pushbutton status void setup() { Serial.begin(9600); // Initialize serial communication at 9600 baud rate pinMode(buttonPin, INPUT); // Set buttonPin as an input pinMode(ledPin, OUTPUT); // Set ledPin as an output pinMode(ledPin1, OUTPUT); // Set ledPin1 as an output pinMode(ledPin2, OUTPUT); // Set ledPin2 as an output } void loop() { buttonState = digitalRead(buttonPin); // Read the state of the pushbutton if (buttonState == HIGH) { // If the button is pressed Serial.println("Hello little lights, it's time to shine"); // Print a message to the serial monitor for (int i = 0; i <= 4; i++) { // Repeat the following block 5 times Serial.println("LED 1 is ON"); // Print a message indicating LED 1 is ON digitalWrite(ledPin, HIGH); // Turn on the first LED delay(1000); // Wait for 1 second Serial.println("LED 2 is ON"); // Print a message indicating LED 2 is ON digitalWrite(ledPin1, HIGH); // Turn on the second LED delay(1000); // Wait for 1 second Serial.println("LED 3 is ON"); // Print a message indicating LED 3 is ON digitalWrite(ledPin2, HIGH); // Turn on the third LED delay(1000); // Wait for 1 second Serial.println("All LEDs are OFF"); // Print a message indicating all LEDs are OFF digitalWrite(ledPin, LOW); // Turn off the first LED digitalWrite(ledPin1, LOW); // Turn off the second LED digitalWrite(ledPin2, LOW); // Turn off the third LED delay(1000); // Wait for 1 second } } else { // If the button is not pressed digitalWrite(ledPin, LOW); // Turn off the first LED digitalWrite(ledPin1, LOW); // Turn off the second LED digitalWrite(ledPin2, LOW); // Turn off the third LED } }