Flowol: Traffic Lights Sequence

The first basic construct in programming is the sequence, which simply means doing one thing after another. We can create a seqence in Flowol with the rectangle (process) and parallelogram (output) shapes. A sequence is one of the three basic things that computer programs can do, the others being repetition and selection - we will come to these in Flowol later.

1. Traffic Lights

Traffic lights provide a good example of a sequence of actions. You can program a set of traffic lights with just two actions in a sequence, turning lights on and off and waiting for a fixed period. Traffic lights with sensors are more advanced: cars or pedestrians can make the lights change and this type of traffic light needs more flowchart techniques.

Work out the sequence of lights for a narrow bridge in advance in a Word document and then try to implement them in Flowol. Load the mimic from the selection available. The mimic shows two sets of traffic lights either side of a narrow bridge. Click on the outputs in the toolbar to work out which output is connected to which light.

You can use a single sequence of events to make your lights work or you could write two separate sequences for each side of the bridge. If you use the second approach you will have to make sure that your sets of lights are coordinated. The second approach is quite sophisticated as it involves 'parallel processing'.

Building the Flowchart

The two types of instruction that you need to put in sequence are turning lights on/off and waiting for a specified time period.

Turning the lights on and off is an output action and is done in a parallelogram flowchart box.

Waiting for a specified time delay is a process and is done inside a flowchart rectangle box.

To turn lights on and off you need to know the numbers of the lights, red, amber and green. You then click on the rectangle symbol in the toolbox, click on the main area of the program and use the settings panel to change the output to off or on.

Note that you can turn as many outputs on or off as you like so you do not need separate boxes for the red and amber lights, you can do them both at once. You will, however, need a separate output box each time there is a delay.

You will need to add a delay for the lights so that you get the correct sequence of lights. The sequence of actions is created by drawing connecting lines between the various boxes in the flowchart.