简体   繁体   中英

Using the magnetic field in Android

So I'm writing an application to see if the device has rotated 360 degrees. The way I do this is using the Accelerometer sensor combined with the Magnetic field sensor. From this method I get three values of the X, Y and Z axes, but how can I use these to calculate where North is?

I already did some testing: When I point one of the axes north, I the value of it turns approximately 0.0, but when I point it south, it also shows me 0.0 and different values per axe when I point it east or west (For X: somewhat around -3.1 east)

Ok so I did some tests today and my solution worked for me, to just take the X value. This works for me because I only have to use it relatively (compare two values). For more information, look at the comment on my question or take look at this article.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM