How to Make a Simple LED Traffic Light

In this tutorial, we will guide you through creating a simple LED traffic light project using OmniBoard Studio.


Steps to Create a Simple LED Traffic Light

1

Open OmniBoard Studio and create a new project.

2

Drag and drop three LED blocks onto the canvas to represent the red, yellow, and green lights. You will need at least three LED blocks, a way to control the timing of the lights, and a way to loop the sequence.

Try to figure out how to connect the blocks on your own! If you need a hint, click here.
  • Use the Start and While True blocks to create a loop that will run indefinitely.
  • Inside the loop, turn the Red LED ON, then wait with a Timer block (e.g. 3000 ms), then turn the Red LED OFF.
  • Next, turn the Yellow LED ON, wait (e.g. 1000 ms), then turn the Yellow LED OFF.
  • Finally, turn the Green LED ON, wait (e.g. 3000 ms), then turn the Green LED OFF. The loop will then repeat from the beginning.
LED Traffic Light Flowchart
3

Build the correct circuit by connecting three LEDs to your microcontroller.

  • Connect the Red LED anode (long leg) through a resistor to the GPIO pin assigned for red (e.g. pin 2), and the cathode (short leg) to ground.
  • Repeat the same wiring for the Yellow LED on a second GPIO pin (e.g. pin 3).
  • Repeat the same wiring for the Green LED on a third GPIO pin (e.g. pin 4).
LED Traffic Light Circuit
4

Compile the code and upload it to your microcontroller.

5

Watch your traffic light cycle through Red → Yellow → Green and repeat!

Bonus Information