Hello,
I m currently using my hmc5883l sensor with library from here:
I tried to run hmc5883l_compass.ino. Since my sensor is placed flat on a vertical surface, I modify
float heading = atan2(norm.YAxis, norm.XAxis);
To
float heading = atan2(norm.YAxis, norm.ZAxis);
As I read the values while turning something strange happens. As I continue to rotate the compass, the values increases but after a certain values it starts decreasing. This value is not 360. Everthings work perfectly before this angle. For me it is around 331 degrees. Once it reaches this angle, heading doesn't change much for a few angle changes. Like if it changed by like 5, 10 degrees from 331, it will keep 331.something.
Serial print looks like this (just a simplified example):
329.54
330.67
331.05
331.76
331.56
331.43
330.23 (still turning in the same direction)
329.56
I thought it could be because my sensor is vertical, so I placed it horizontally n use tan(y/x) but gave the same problem.
I would really appreciate it if anyone could explain to me what happened and/or suggest a solution.
Thanks in advance.