Accessing the Accelerometer and Gyroscope in JavaScript

Now that you can access motion sensors in both Google Chrome and mobile browsers, I decided to demo a couple of sample application which hook into the accelerometer and gyroscope:


If you want to see these applications in action and/or check out the code, the links are below:

Note that the compass application only works on devices with gyroscopes (no laptops that I know if), and requires iOS 5 or newer.