THANK YOU! I could NOT find any info on this anywhere! You have just
made me very happy!

On Dec 13, 7:08 am, Peli <[email protected]> wrote:
> 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 convert
> phi from radians to degree (using phideg = Math.toDegree(phi);)
>
> Note that this only works if your phone lies flat on the desk. In
> arbitrary orientation, you need more sophisticated conversion that
> includes x, y, and z and the accelerometer values.
>
> Peliwww.openintents.orghttp://www.openintents.org/en/node/6
>
> On 13 Dez., 03:32, Jeffrey <[email protected]> wrote:
>
>
>
> > 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 <[email protected]> wrote:
>
> > > I'm working on an application that will randomly point an arrow in a
> > > direction, and have that arrow maintain it's direction if the device
> > > is moved. All I want to do it get the magnetic field readings as
> > > degrees and I can do it from there. The problem I'm having is getting
> > > the magnetic field readings. I can't find any tutorials on it and the
> > > API demo on google's dev site uses deprecated code (figures, google's
> > > sample code is never n00b friendly).
>
> > > At this point I've got this together but I don't know what I'm
> > > missing, all the examples I can find are using SensorListener which
> > > has onSensorChanged(int sensor, float[] values) but
> > > SensorEventListener does not support "float[] values"
>
> > > What am I missing here?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to