Skip to the content.

railroad crossing

Railroad crossing MicroCode program

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 set angle tile servo uses a servo motor move to move an physical arm. The servo set angle tile 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 move servo to 1 o'clock

when press button B, do move servo to 5 o'clock

The LED LED uses a programmable LED ring module to display blue and red colors.

when press button A, turn LEDs to red

when press button B, turn LEDs to blue

when press button B, show LED rainbow animation and repeat