// Step 1: Define constants for LED pins
const int GREEN_LED_PIN = 17; // GPIO 17 for Green LED
const int YELLOW_LED_PIN = 18; // GPIO 18 for Yellow LED
const int RED_LED_PIN = 19; // GPIO 19 for Red LED
// Step 2: The setup() function runs once when the ESP32 starts
void setup() {
// Initialize serial communication at 115200 baud (optional for debugging)
Serial.begin(115200);
// Step 3: Configure LED pins as OUTPUT
pinMode(GREEN_LED_PIN, OUTPUT); // Set Green LED pin as output
pinMode(YELLOW_LED_PIN, OUTPUT); // Set Yellow LED pin as output
pinMode(RED_LED_PIN, OUTPUT); // Set Red LED pin as output
}
// Step 4: The loop() function runs continuously after setup()
void loop() {
// Blink the Green LED
Serial.println("Green LED ON"); // Print status to Serial Monitor
digitalWrite(GREEN_LED_PIN, HIGH); // Turn on Green LED
delay(3000); // Wait for 3 seconds
digitalWrite(GREEN_LED_PIN, LOW); // Turn off Green LED
delay(500); // Short delay before next LED
// Blink the Yellow LED
Serial.println("Yellow LED ON"); // Print status to Serial Monitor
digitalWrite(YELLOW_LED_PIN, HIGH); // Turn on Yellow LED
delay(3000); // Wait for 3 seconds
digitalWrite(YELLOW_LED_PIN, LOW); // Turn off Yellow LED
delay(500); // Short delay before next LED
// Blink the Red LED
Serial.println("Red LED ON"); // Print status to Serial Monitor
digitalWrite(RED_LED_PIN, HIGH); // Turn on Red LED
delay(3000); // Wait for 3 seconds
digitalWrite(RED_LED_PIN, LOW); // Turn off Red LED
delay(500); // Short delay before repeating the loop
}