![]()

This program controls a railroad crossing. This sample is using Jacdac modules to extend the micro:bit with programmable LEDs, servo and other sensors/actuators.
The
servo uses a servo motor move to move an physical arm. The
servo arm orientation is mapped to the wall clock hours: 0 (or 12) is on rotated 90 degree from the resting position to the left, 6 is rotated 90 degree right from the rest position.
There is also a secret animation mode when you press the micro:bit logo button.

- when
press
button A, do
servo set arm to 1 o’clock.

- when
press
button B, do
servo set arm to 5 o’clock.
The
LED uses a programmable LED ring module to display blue and red colors.

- when
press
button A, do
LED set all color to
red, black and repeat.

- when
press
button B, do
LED set all color to
blue, black and repeat.

- when
press
button B, do
LED show rainbow animation.