Thursday, February 26, 2009 at 2:33 PM |  
Another awesomely cool feature of the IPhone and IPod Touch is the built in accelerometer which can detect when the device is moving. The accelerometer is a 3-dimensional one in that it can detect movement in any direction. This lends to some interesting applications including ones that sense whether the IPhone is being shook (maybe to erase a drawing in a paint program) or tilted (to steer a car in a racing program) among others. Luckily, it's very simple to use. I followed two tutorials from this chapter. One detects if the device is being shook and makes a breaking glass sound and shows a picture of a broken screen. The other simulates the rolling of a marble depending on how you tilt your screen. Both are very cool. I've uploaded the sample code.



Posted by JP

0 comments: