Go Down

Topic: Using accelerometer to control computer games? (Read 4807 times) previous topic - next topic


How do I use the accelerometer in Arduino Esplora to control computer games as if the Arduino Esplora is a tablet? I controlled a game on a tablet by tilting the tablet.


You can check the game I ported to the Esplora which uses the accelerometer.  Writeup is at http://21stdigitalhome.blogspot.com/2013/01/first-self-contained-arduino-esplora.html
and the code at https://github.com/TheKitty/EsploraApps

The game saves all the values: x, y, and z but I think it actually only processes the x values - if you shake one way it moves the ball in the direction of the shake along thepositive or negative x axis.  It uses the Esplora.readAccelerometer function, documentation at http://arduino.cc/en/Reference/EsploraReadAccelerometer. I found that the movement was opposite of what the Esplora library thought was positive so I multiplied by negative one to change it.

If you've done accelerometer controlled gaming/programming before, it is straightforward.  I hope this helps.

Go Up