How to Make a Microbit Stop Light and Crosswalk Button

by Drescherl in Teachers > University+

33 Views, 0 Favorites, 0 Comments

How to Make a Microbit Stop Light and Crosswalk Button

microbittrafficlightcrosswalksimulator.jpg

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

Supplies

IMG_2713.jpg

1 microbit

3 LEDS

3 extension ground wires

1 microbit extension board

4 wires

1 breakboard

1 battery pack

Start a New Project

step 1.jpg

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

Set Up Pins

step2.jpg

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

step3.jpg

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

Add an Interrupt

step4.jpg

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

Add Pins

step5.jpg

Add 6 pins.


  1. Set the first to turn the green light, pin 0, off.
  2. Set the second pin, the yellow light, to turn on
  3. Set the second pin, the yellow light, to turn off
  4. Set the third pin, the red light, to turn on
  5. Set the third pin, the red light, to turn off
  6. Set the first pin, the green light, to turn on

Add Pauses

step6.jpg

Add pauses between pins on the press "A" button

Add Repeat Loops

step7.jpg

Add three repeat loops in between the pins

Add Flashing LEDS

step8.jpg

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

Add Directions

step9.jpg

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

step10.jpg

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

IMG_2713.jpg

Gather pieces required to set up microbit

Set Up Microbit

microbittrafficlightcrosswalksimulator.jpg

Place microbit in extension board. Connect wires.

Play Test

step11.jpg

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

step12.jpg

Press the A button to start the program

Yellow Lights Will Flash

step14.jpg

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

WALK

step15.jpg

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

Countdown

step16.jpg

LED countdown from 9 to 1.

Flashing Lights

step17.jpg

LED panel will flash

Resume Green Light

step18.jpg

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