Skip to content

Commit

Permalink
project one codes
Browse files Browse the repository at this point in the history
  • Loading branch information
iameugeneyeboah committed Jan 12, 2025
1 parent 3f3b2ed commit e3c655b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions iameugeneyeboah/project 1/project_one.cpp
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
}

0 comments on commit e3c655b

Please sign in to comment.