Hi!
I'm using the CMPS2 compass module with an Arduino Uno and the example code from https://reference.digilentinc.com/reference/pmod/pmodcmps2/start#example_projects to get a heading from the compass module, but it seems to be only jumping between specific values and never taking the values in between. For example, running the program while keeping the module horizontal and slowly spinnng it 360° around the z-axis gives an output like this:
Heading = 231.18°
Heading = 231.19°
Heading = 186.09°
Heading = 141.09°
Heading = 186.12°
Heading = 231.10°
Heading = 231.09°
Heading = 231.08°
Heading = 231.09°
Heading = 231.03°
Heading = 230.96°
Heading = 321.25°
Heading = 321.15°
Heading = 321.04°
Heading = 51.20°
Heading = 51.06°
Heading = 51.06°
Heading = 50.96°
Heading = 50.91°
Heading = 96.12°
Heading = 96.10°
Heading = 51.00°
Heading = 141.17°
Heading = 141.11°
Heading = 141.12°
Heading = 141.04°
Heading = 141.04°
Heading = 186.11°
Heading = 141.01°
Heading = 231.16°
Heading = 231.16°
Heading = 231.16°
Basically, plotting the heading as a function of time doesn't give a continuos plot no matter how slowly the module rotates.
I have tried to check for disturbances from metal objects or electronic devices using another compass, so I'm pretty sure that's not the problem.
I don't need to get down to the 1° accuracy promised by the maker (5° is probably enough for my project), but these giant leaps from 320° to 50° won't work.
All help is appreciated!