// Define the LED pins for NodeMCU
const int redPin = 25; // Red LED connected to D1
const int yellowPin = 26; // Yellow LED connected to D2
const int greenPin = 33; // Green LED connected to D3
void setup() {
// Initialize the LED pins as outputs
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
// Start Serial communication
Serial.begin(115200);
}
void loop() {
// Red LED blinks for 5 seconds
digitalWrite(redPin, HIGH); // Turn on red LED
digitalWrite(yellowPin, LOW); // Turn off yellow LED
digitalWrite(greenPin, LOW); // Turn off green LED
Serial.println("STOP");
delay(5000); // Red LED on for 5 seconds
// Yellow LED blinks for 3 seconds
digitalWrite(redPin, LOW); // Turn off red LED
digitalWrite(yellowPin, HIGH); // Turn on yellow LED
digitalWrite(greenPin, LOW); // Turn off green LED
Serial.println("WAIT");
delay(3000); // Yellow LED on for 3 seconds
// Green LED blinks for 8 seconds
digitalWrite(redPin, LOW); // Turn off red LED
digitalWrite(yellowPin, LOW); // Turn off yellow LED
digitalWrite(greenPin, HIGH); // Turn on green LED
Serial.println("GO");
delay(8000); // Green LED on for 8 seconds
}