In this example, the parallel port output from a computer (PORT &H378) is used to control traffic lights at a cross road junction. A zero on one of the data lines will cause the corresponding light to be off. A one on one of the data lines will cause the corresponding light to be on. The two sets of lights in the diagram below represent the two sets of lights at the cross roads. D6 and D7 are not used.

Traffic Lights wired up to the Parallel Port

Here is some example QBasic code to control the lights ...

start:
        OUT &H378, &H01    ' Turn on the red bulb on the left hand pole.
        PRINT "01"         ' This is for debugging the program and is not really needed
        SLEEP 1            ' A one second time delay

        OUT &H378, &H02    ' Turn on the amber bulb on the left hand pole.
        PRINT "02"         ' This is for debugging the program and is not really needed
        SLEEP 1            ' A one second time delay

        OUT &H378, &H03    ' Turn on the red and amber bulbs on the left hand pole.
        PRINT "03"         ' This is for debugging the program and is not really needed
        SLEEP 1            ' A one second time delay

        GOTO start         ' Go back to the start and do it all again

Your task is to
    a) design the control data needed to step the lights through a realistic sequence.
    b) write and test the program to step the lights correctly.
    c) design and code the time delays so they are about right.