Traffic Light 1-Way
From Flowcode Help
Jump to navigationJump to searchTraffic lights are essential in modern road networks to help control and maintain the flow of traffic.
The lights must be clear to read and follow a regular pattern to allow motorists and other road users to know without any chance of confusion what the lights mean and what will come next in the sequence.
Exercise 1
Setup and analyse the light patterns of a traffic light.
Tasks
- Create a new flowchart, and select ‘No chip’ as the target device. We choose no chip as this is a simulation only exercise.
- Add the ‘Traffic Light 1-Way’ component to the 3D Panel, from the ’Simulation -> Scenarios’ category.
- Adjust the 3D Panel so that you can see the traffic light, The Preset Views button or clicking the arrows at the top left of the 3D Panel window can be very helpful.
- Add a loop to your program to loop forever until the simulation stop button is pressed.
- Use the component macro ‘AutomaticMode’ to start the lights moving through its pre-programmed light patterns.
- Start the simulation running and count the different states the lights can be in.
Working Example
Below you will see a working example to monitor the light sequence of a simple 1-way traffic light.