The Traffic Light Micro:Bit!

The Traffic Light Micro:Bit cycles through three LEDs, red, yellow, and green, in an authentic pattern!

The Code!

basic.forever(function () {

pins.digitalWritePin(DigitalPin.P0, 1)

pins.digitalWritePin(DigitalPin.P1, 0)

pins.digitalWritePin(DigitalPin.P2, 0)

basic.showString("Traffic")

pins.digitalWritePin(DigitalPin.P0, 0)

pins.digitalWritePin(DigitalPin.P1, 1)

pins.digitalWritePin(DigitalPin.P2, 0)

basic.showString("Light")

pins.digitalWritePin(DigitalPin.P0, 0)

pins.digitalWritePin(DigitalPin.P1, 0)

pins.digitalWritePin(DigitalPin.P2, 1)

basic.showString("Program")

})