Pages: [1]   Go Down
Author Topic: Using accelerometer to control computer games?  (Read 1990 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 3
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

US
Offline Offline
Full Member
***
Karma: 4
Posts: 183
Electronics are the new Legos
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: