fbpx
Traffic Light
MagicBlocks Project

Traffic Light

Simulate Traffic Light with Magicbit

What is Traffic Light?

Traffic Lights are signaling devices positioned at road intersections, pedestrian crossings, and other locations in order to control flows of traffic.

Part 1: Manual control using inject blocks

For this, you will need the following nodes.

 

Using the above blocks, make the following.

Double click on one inject node which is connected to the Digital out node and change as follows.

 

Double click on the other inject node which is connected to the Digital out node and change as follows.

 

Double click on the Digital out node and select the correct device id.

When selecting LEDs, select Red, Yellow, and Green because we are creating a traffic signal light.

 

Deploy and press buttons in inject node and see what’s happening.

Part 2: Blinking yellow light

For this, you will need the following nodes.

 

Connect them as follows.

Double click on the inject node and change as follows.

 

Double click on the trigger node and change as follows.

 

Like in the first part change settings in the Digital out node and select the Yellow LED.

 

Deploy the program and see what happens.

Part 3: Complete traffic light system

For this, you will need the following nodes.

Connect them as follows.

To change the trigger time in the trigger node, change the value in the following selected area.

 

To change the delay time in the delay node, change the value in the following selected area.

 

Change the values in all trigger and delay nodes as shown in the image in part 5.

Change the settings in the Digital out node as in the before steps. (For the first Digital out node select red LED, for the second Digital out node select yellow LED and for the last Digital out node select green LED)

Related Posts
Leave a Reply