Program micro:bit traffic light sequences in Python with these STOP:bit tutorials

coding logic microbit microbit accessories micropython python radio state table steam stem traffic light traffic lights tutorials wireless

Check out our tutorials for the Kitronik STOP:bit and the BBC micro:bit - they're great for kids aged 8 and upwards!

Kitronik STOP:bit traffic light

Note: the tutorials reference the Australian traffic light sequence i.e. Green -> Amber -> Red, but can be adapted for other sequences.

In the first tutorial, you'll learn to turn individual coloured lights on and off, with a single traffic light. We'll create a Python function to make our code reusable, and model the different combinations of lights in a state table. Then, repeat your sequence with a loop.
The second tutorial combines two traffic lights to expand the state table for an intersection. Save time by using your Python function from the first tutorial; then add radio communications to coordinate the second traffic light with the first.

The concepts introduced in these tutorials include:

  • using a function, that takes input to decide which light sequence to display;
  • modelling sequences in state tables; and
  • using a stateless radio network to coordinate two separate devices.

    Learn more about the Kitronik STOP:bit here and the micro:bit essentials/Go kit here 

    Download the tutorials as a pdf here.

     

     

     

     

     


    Older Post Newer Post