

No libraries required. arduino
// Define the pin numbers for the LEDs
const int redLed = 9;
const int yellowLed = 10;
const int greenLed = 11;
void setup() {
// Set the LED pins as output
pinMode(redLed, OUTPUT);
pinMode(yellowLed, OUTPUT);
pinMode(greenLed, OUTPUT);
} void loop() {
// Red light for 5 seconds
digitalWrite(redLed, HIGH);
delay(5000);
digitalWrite(redLed, LOW);
// Yellow light for 2 seconds digitalWrite(yellowLed, HIGH);
delay(2000);
digitalWrite(yellowLed, LOW);
// Green light for 5 seconds
digitalWrite(greenLed, HIGH);
delay(5000);
digitalWrite(greenLed, LOW);
}
No downloadable resources added yet.
Please login to leave a comment.
No comments yet. Be the first to share your thoughts!