forked from MIT-Emerging-Talent/ET6-practice-code-review
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f3b2ed
commit e3c655b
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Define LED pins | ||
const int redLight = 13; // Red LED connected to pin 13 | ||
const int yellowLight = 12; // Yellow LED connected to pin 12 | ||
const int greenLight = 11; // Green LED connected to pin 11 | ||
|
||
void setup() { | ||
// Set all LED pins as outputs | ||
pinMode(redLight, OUTPUT); | ||
pinMode(yellowLight, OUTPUT); | ||
pinMode(greenLight, OUTPUT); | ||
} | ||
|
||
void loop() { | ||
// Turn on Red Light | ||
digitalWrite(redLight, HIGH); | ||
digitalWrite(yellowLight, LOW); | ||
digitalWrite(greenLight, LOW); | ||
delay(5000); // Wait for 5 seconds | ||
|
||
// Turn on Green Light | ||
digitalWrite(redLight, LOW); | ||
digitalWrite(yellowLight, LOW); | ||
digitalWrite(greenLight, HIGH); | ||
delay(5000); // Wait for 5 seconds | ||
|
||
// Turn on Yellow Light | ||
digitalWrite(redLight, LOW); | ||
digitalWrite(yellowLight, HIGH); | ||
digitalWrite(greenLight, LOW); | ||
delay(2000); // Wait for 2 seconds | ||
} |