How to Make a Microbit Stop Light and Crosswalk Button
by Drescherl in Teachers > University+
96 Views, 0 Favorites, 0 Comments
How to Make a Microbit Stop Light and Crosswalk Button

This is an Instructable for creating a crosswalk program on a traffic light and then testing it.
Supplies

1 microbit
3 LEDS
3 extension ground wires
1 microbit extension board
4 wires
1 breakboard
1 battery pack
Start a New Project

Create a new microbit project at https://makecode.microbit.org/
Set Up Pins

Scroll down to "pins" and grab 3. Label them pin 0, pin 1, and pin 2. Select pin 0 as your green light and set it to 1 (on), and set the other 2 pins to 0 (off).
Add LED's

Select LED's and use the blackout screen to simulate the crosswalk signal saying not to walk.
Add an Interrupt

Create a new input adding the "on button A pressed"
Add Pins

Add 6 pins.
- Set the first to turn the green light, pin 0, off.
- Set the second pin, the yellow light, to turn on
- Set the second pin, the yellow light, to turn off
- Set the third pin, the red light, to turn on
- Set the third pin, the red light, to turn off
- Set the first pin, the green light, to turn on
Add Pauses

Add pauses between pins on the press "A" button
Add Repeat Loops

Add three repeat loops in between the pins
Add Flashing LEDS

Add flashing LEDS's after the pin that turns off the green traffic light and turns on the yellow traffic light.
Add Directions

After the yellow LED turns off and the red LED turns on, in the repeat loop add a pause and the string "WALK". Then, outside of the repeat loop command, add a numeric countdown from 9 to 1.
End Cycle

Add the show LED's in the repeat loop. After they flash four times set the LED to the blackout screen and then have the red LED turn off and the green LED turn back on.
Set Up

Gather pieces required to set up microbit
Set Up Microbit

Place microbit in extension board. Connect wires.
Play Test

Turn on the microbit and check that the program is running. You should see a green light, and a solid LED block.
Press a Button

Press the A button to start the program
Yellow Lights Will Flash

Green light turns off, yellow light turns on, LED screen flashes
WALK

Red light will turn on when the yellow light turns off and LED screen will project "WALK"
Countdown

LED countdown from 9 to 1.
Flashing Lights

LED panel will flash
Resume Green Light

Red light turns off, LED stops flashing, Green light resumes