A browser-based Space Invaders clone controlled by a BBC micro:bit v2 over Bluetooth Low Energy (Web Bluetooth API). Tilt the micro:bit left/right to move your ship; press Button A or B to fire. A keyboard fallback (arrow keys + space) is included for testing without hardware.
The browser talks to the micro:bit's standard Bluetooth Accelerometer Service and Button Service, so the micro:bit just needs Bluetooth enabled with those services advertised — no custom firmware logic required.
Easiest way, using MakeCode:
- Create a new project.
- Drag in the bluetooth category blocks (search "bluetooth" in the toolbox) — add:
bluetooth accelerometer servicebluetooth button serviceunderon start.
- Go to Project Settings → micro:bit version and make sure it's targeting V2 (BLE pairing-free mode works best on V2).
- Download the
.hexfile and drag it onto your micro:bit (it mounts as a USB drive). - After flashing, the micro:bit will restart and begin advertising as
BBC micro:bit [xxxxx].
Note: the default "radio" firmware that ships on a fresh micro:bit does not advertise these GATT services — you must flash a MakeCode (or other) program that explicitly adds the bluetooth blocks above.
Web Bluetooth requires a secure context (HTTPS or localhost) — opening index.html directly via file:// will not work.
From this folder, run any static server, e.g.:
python -m http.server 8080Then open http://localhost:8080 in Chrome or Edge (Web Bluetooth isn't supported in Firefox/Safari).
- Click Connect micro:bit and select your device from the browser's pairing dialog.
- Tilt the micro:bit left/right to steer your ship.
- Press Button A or Button B to fire.
- Click Start Game.
No micro:bit handy? Click Play with Keyboard Instead and use Arrow keys + Space.
index.html Page layout / HUD
css/style.css Styling
js/microbit.js Web Bluetooth wrapper for the micro:bit GATT profile
js/game.js Canvas-based game engine (input-agnostic)
js/main.js Wires micro:bit + keyboard input into the game