Thursday 11 December 2014

MIT App Inventor - Accelerometer App

At 2014 CS4HS myself and several of the physics teachers decided grabbing the accelerometer data from a smartphone could be quite a good way of linking physics with digital technologies, but of course it's more fun to get the students to write it themselves than to get me to do it for them!

Regardless here's the rough outline for w MWE (minimum working example). You will need 6 label elements (one title and one reading for each direction), the accelerometer element and a clock element. I arranged mine using the horizontal arrangement sections like this:
Then all we need to do is connect the blocks in such a way that  the accelerometer data is printing to the screen with each 'tick' of the clock. Doing it this way prevents the phone trying to query the accelerometer sensor too quickly.

Challenge: Extend your app to store the accelerometer data using the TinyDB element to be printed out to the screen (or possibly to a file for plotting) at a later date