Starter set for the BBC micro:bit activity guide

Page 14

Pedestrian signal with flashing light Let's start the second part of the task. trafficlight2.hex

After the 5 seconds is complete, the green lamp should flash three times. The flashing frequency is 1 second. Then the light is switched to red. Here, you will use the command “repeat x times” from the “Loops” block. Dock it after the 5 second pause. Change the repetitions from “4” to “3”. Add a 1 second pause. Then the command “digital write pin P12 to 0” follows. Then another 1 second pause command follows, and the command to switch on the P12. After the write command, add a 1 second pause command. Now the second part of the task is programmed. Save the file on your computer. Test it out virtually, then test it a second time on your model.

14


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.