The micro:bit side of board-explorer: a MakeCode program that receives one-letter commands over Bluetooth Low Energy and drives a ring:bit car and its two RGB LEDs.
On start, the micro:bit shows a ghost icon, opens the Bluetooth UART service, sets up the ring:bit car (wheels on pins P1 and P2) and lights its two NeoPixel LEDs (pin P0) green. It then waits for lines on the Bluetooth UART, sent by board-explorer from an arcade joystick:
| Command | Action |
|---|---|
z |
go forward at full speed |
s |
reverse at full speed |
q |
turn left |
d |
turn right |
w, or anything else |
brake |
o |
make the LEDs blink green and blue |
p |
show green |
Button A also drives forward and button B brakes, to test the car without Bluetooth.
Prototype from 2020, no longer developed. Provided as is, mostly for educational use.
- Worked in 2020 (not re-tested on hardware since): the commands above, sent by board-explorer from a USB joystick.
- Known bug:
pshows green but does not clear theblinkflag, so onceohas been received the LEDs keep blinking. - The
upleftbranch of the forever loop is never triggered (the variable is always 0). - The MakeCode build workflow (
.github/workflows/makecode.yml) targets Node.js 8 and has not run in years; expect it to fail.
Requirements: a BBC micro:bit, an Elecfreaks ring:bit car, and a browser.
- Flash it as is: open https://makecode.microbit.org/_frdR5xctm0Rt, then Download and copy the
.hexfile to the micro:bit. - Edit it: open https://makecode.microbit.org/, click Import, then Import URL, and paste
https://github.com/storagebits/board-explorer-makecode. - Use it as an extension: in a new MakeCode project, open Extensions from the gear menu and search for
https://github.com/storagebits/board-explorer-makecode. - Command line (optional, needs pxt):
make build,make deploy,make test.
Then run board-explorer on the Raspberry Pi with this micro:bit's name; see its README.
pxt.json declares the dependencies (core, bluetooth and RingbitCar from tinkertanker/pxt-ringbitcar v3.0.3) and opens Bluetooth pairing ("open": 1: no pairing needed, so any nearby device can connect). Pins are set in main.ts: wheels on P1 and P2, two NeoPixel LEDs on P0.
main.blocks, main.ts, main.py the program (blocks, and its TypeScript and Python views)
pxt.json MakeCode project: dependencies, Bluetooth settings
test.ts empty test file
.github/makecode/ rendered blocks images
Makefile, Gemfile, _config.yml MakeCode command-line and GitHub Pages scaffolding
Released under the MIT licence. The project scaffolding (Makefile, Pages and workflow files) comes from the Microsoft MakeCode extension template (MIT). Depends on pxt-ringbitcar by Tinkercademy (MIT) and Microsoft's pxt-neopixel (MIT), fetched by MakeCode.
- for PXT/microbit
