I got it working, the phone will only need to be lying flat, so that
made it a lot easier. It seems like google should mention somewhere
that you need to use trig to get degree's from the compass... That
doesn't quite seem like general knowledge. Though I had a problem with
the activity force
Jeffrey wrote:
It seems like google should mention somewhere
that you need to use trig to get degree's from the compass...
That's because you don't.
http://github.com/commonsguy/cw-advandroid/tree/master/Sensor/Compass/
Or, to quote from the docs:
Sensor.TYPE_ORIENTATION:
All values are
You need basic trigonometry:
http://en.wikipedia.org/wiki/Trigonometry
if x and y denote the magnetic field strength in microtesla, then you
get the angle through the arc tangent function:
phi = Math.atan(y/x);
or phi = Math.atan2(y,x);
phi is then the angle in radians. Note that you may want to
Here's my code for capturing orientation data... This is a snippet so
has not been compiled, but should give you and idea.
Keep in mind that you should register the sensors with something like
this when ever you want to start listening to sensors:
sensorMgr = (SensorManager)
Okay, so I got a little further, I'm now stuck at the point where I
can pull values, but they are the micro-tesla measurements. How do I
get degrees from this?
On Dec 12, 8:13 pm, Jeffrey jeffisagen...@gmail.com wrote:
I'm working on an application that will randomly point an arrow in a
5 matches
Mail list logo