I'm making an AR app similar to Google Sky Map, and need my roll value to go from -90 degrees when the handset is laying flat, to 0 degrees when the user is holding the handset perpendicular to the ground, and to +90 degrees when pointing the back of the handset (ie, the camera directly up into the sky.
My problem is that the accelerometer sensor returns values from -90 to +90, but +90 is when the handset is perpendicular to the ground. I can't simply subtract 90 from the value, because the values start to decrease as the handset starts to tilt back. So basically, I need a way of knowing when the handset has gone beyond +90?
Sorry if I haven't explained this very well, it's quite hard to get across in words.
edit: 12/03/12
I used this: http://www.mail-archive.com/android-beginners@googlegroups.com/msg23415.html