This small DIY project combines fun of game programming and super exciting capabilities of Arduino boards.
Asteroids game is loosely based on classic arcade space shooter. It is coded in JavaScript using p5.js client-side library for pleasant visual and interactive experience.
The Glove designed as game controller is equipped with five bend sensors placed in fabric veins on top of each finger. Microcontroller mounted on the cuff captures movement in 3D space and sends this information via serial communication to a computer. The data is read by a simple Node.js based WebSocket server API and set as an input to a browser. The glove also includes super vibrant RGB LED ring for visual feedback.
The objective of Asteroids game is to destroy asteroids. The player controls a triangular ship that can rotate left and right, fire shoots straight forward. To move the ship, player applies thrust in a desired direction. To collect points, asteroids need to be destroyed. To collect extra spaceships (lives) player freezes and shoots frozen asteroids.
Game as well can be controlled with keyboard.
- Middle finger/:arrow_up: - direction and thrust
- Thumb/space - shooting
- Index finger/:arrow_down: - freeze asteroids
- Adafruit Pro Trinket Microcontroller with 5V operating logic and ATmega328 chip with 16MHz clock rate.
- 5 long Flex sensors
- Adafruit FLORA 9-DOF Accelerometer/Gyroscope/Magnetometer LSM9DS0
- Adafruit NeoPixel Ring 16 x 5050 RGB LED with Integrated Drivers - for fun :)
- FTDI to USB cable
After cloning the project, enter the following lines on the command-line:
$ npm install
$ npm start
- sewing 😃
- coding microcontrollers
- how painful sensor calibration can be
- making USB port talk to a browser
- coding fully controllable game
- generating randomly shaped asteroids on canvas

