Project 1.4.1: RED MEANS STOP¶
Description | This teaches you how to turn ON and also turn OFF the red light only on the traffic light module. |
---|---|
Use case | Programming the red light on the traffic to turn ON which will signal drivers and riders to stop. |
Components (Things You will need)¶
![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|
Building the circuit¶
Things Needed:
- Arduino Uno = 1
- Arduino USB cable = 1
- Traffic light module = 1
- Red jumper wires = 1
- White jumper wire= 1
Mounting the component on the breadboard¶
Step 1: Take the Traffic light and the breadboard, insert the Traffic light into the horizontal connectors on the breadboard.
.
WIRING THE CIRCUIT¶
Things Needed:¶
- Red male-male-to-male jumper wires = 1
- White jumper wire = 1
step 1: Take the red jumper wire. This wire will connect the Arduino UNO the red light (red pin) of the traffic light. This pin is labeled “R” on the traffic light.
step 2: Connect one end of the red jumper wire to R pin of traffic light on the breadboard. Ensure you put the pin in the right hole.
step 3: Connect the other end of the red jumper wire to pin number 5 on the Arduino UNO.
.
step 4: Take the white jumper wire and connect one end to the GND pin of the traffic light.
step 5: Connect the other end of the white jumper wire to GND on the Arduino UNO.
.
PROGRAMMING¶
Step 1: Open your Arduino IDE. See how to set up here: Getting Started.
Step 2: Type const int red = 5;
before the void setup function.
.
Step 3: Type the following codes in the void setup function as shown below;
.
Step 4: Type the following codes in the void loop function as shown below;
.
The digitalWrite () function controls the state of the pin. The pin can either be HIGH or LOW. The HIGH state turns on the LED. As a result, the code below turns on the LED.
NB: To turn off the traffic light
Step 5: Change the digitalWrite (red, HIGH);
into digitalWrite (red, LOW);
.
Uploading the code¶
Step 1: Save your code. See the Getting Started section
Step 2: Select the arduino board and port See the Getting Started section:Selecting Arduino Board Type and Uploading your code.
Step 3: Upload your code. See the Getting Started section:Selecting Arduino Board Type and Uploading your code
OBSERVATION¶
When the circuit is functioning, observe the Red LED of the tgrafic ligth emitting light as expected. This indicates that the buzzer is receiving the signal correctly from the Arduino and is operating as intended.
CONCLUSION¶
summary, the project centered on the illumination of a red light in a simulated traffic light system provides a fundamental understanding of basic electronics and visual signaling. By lighting the red LED, participants grasp the concept of circuit connections, output control, and the role of color-coded signals. This undertaking serves as a cornerstone in electronics exploration, illustrating the significance of clear visual cues and sparking interest in practical applications, such as traffic management and safety systems.