Tag Archives: accelerometer

Sensors: Using the Accelerometer to detect motion

This tutorial introduces the accelerometer – at a high level – as a tool to detect the phone being shaken. You can use this feature as another kind of user input to your app – for example, make a game where shaking the phone resets the game play or starts a new game.

An accelerometer is a hardware device that detects and measures motion, typically in three axes: X, Y and Z. For example, if the phone is moved left or right, the acceleration changes in the X axis and the accelerometer returns a value indicating the X axis movement.

Smart phones – and many modern devices – have special hardware accelerometer components built in. The orientation sensor, described previously, is actually a software sensor that uses the hardware accelerometer but converts acceleration into orientation values.

The purpose of this demonstration app is to show one example of using the accelerometer.

The user interface is simple – it displays a Start button and a Stop button, and the status of the accelerometer.

AccelUI

 

Continue reading Sensors: Using the Accelerometer to detect motion