Creating a simple traffic light control system with an Arduino to control LEDs

Creating a simple traffic light control system with an Arduino to control LEDs

From Tuesday, October 15, 2024 12:55 PM
to Tuesday, October 15, 2024 1:31 PM

St Thomas More College Margaret Mortimer Secondary School

Open in-person activity

English

Santa Lucija, MLT

Components Needed:

  • Arduino board (Arduino Uno)
  • 3 LEDs (Red, Yellow, Green)
  • 3 220-ohm resistors
  • Breadboard and jumper wires

Circuit Diagram:

  1. Connect the red LED's anode to pin 13 and cathode to ground (through a resistor).
  2. Connect the yellow LED's anode to pin 12 and cathode to ground (through a resistor).
  3. Connect the green LED's anode to pin 11 and cathode to ground (through a resistor).

Arduino Code:

// Define LED pins const int redLED = 13; const int yellowLED = 12; const int greenLED = 11; void setup() { // Set LED pins as OUTPUT pinMode(redLED, OUTPUT); pinMode(yellowLED, OUTPUT); pinMode(greenLED, OUTPUT); } void loop() { // Red light on digitalWrite(redLED, HIGH); delay(5000); // Keep red on for 5 seconds // Red light off, Yellow light on digitalWrite(redLED, LOW); digitalWrite(yellowLED, HIGH); delay(2000); // Keep yellow on for 2 seconds // Yellow light off, Green light on digitalWrite(yellowLED, LOW); digitalWrite(greenLED, HIGH); delay(5000); // Keep green on for 5 seconds // Green light off digitalWrite(greenLED, LOW); }

    Secondary school
    Robotics

Longitude: 14.507352
Latitude: 35.862735
Geoposition: 35.8627346,14.5073518

Nearby upcoming activities:

Tower of Hanoi - Computational Thinking
Mon, Mar 24, 2025 1:40 PM

An unplugged activity where students have to solve the puzzle with 4 disks using the minimum amount of moves (15). Students are to represent the steps involved in a flowchart

Europe CodeWeek...per tutto l'anno!
Fri, Oct 18, 2024 8:00 AM

Raccolta di attività dei plessi di San Nicola, Aieta, Praia dell'IC Praia 

Plateforme d'apprentissage de la programmation en ligne.
Sat, Oct 1, 2022 12:00 AM

http://www.prof.tn

Plateforme d'apprentissage de la programmation à distance en utilisant Moodle.

Chaque enseignant dispose d'un espace par niveau d'apprentissage qui sera partager pour ces collègues et pour ces élèves avec une interraction complète.

Chaque élève peut profiter des ressources et des activités de tous les enseignants dans un même endroit.

Merci.