Space Gun
Shoot descending enemies by tilting the board — left/right to steer, forward for more fire, back for less. Onboard LEDs show your fire rate and pulse on hits.
Hold the board flat with the USB cable facing away from you. Tilt left/right to steer the ship; tip the far edge down (forward) to raise fire rate, and tip it toward you to slow or stop shooting. The sketch streams accel samples over BLE (~25 Hz); the browser maps X to ship position and Y to shots per second.
Fire-rate is quantized into five LED levels (off → blue → cyan → green → amber) written only when the level changes, so the board continuously shows how hard you are shooting. Hits flash green, damage flashes red, and game over strobes — then the rate display resumes.
Flash the Space Gun sketch (advertises Nano33-Gun), connect, press Play, and clear enemies before they reach you or slip past the bottom.
Goals
- Steer a ship with accelerometer X tilt and control fire rate with Y tilt
- Stream sustained LED fire-rate levels plus hit/damage pulses over BLE
- Survive waves of descending enemies without buttons
Materials
- Arduino Nano 33 BLE Sense (onboard LSM9DS1 + RGB LED)
- USB cable
- Arduino IDE with ArduinoBLE and Arduino_LSM9DS1