Qwiic Micro Magnetometer - MMC5983MA Hookup Guide
Contributors:
Ell C
Example 2: I2C Digital Compass
Example 2 shows how to compute the heading based on the basic X/Y/Z readings from the sensor over Qwiic. To find this example, go to File -> Examples -> SparkFun MMC5983MA Magnetometer Arduino Library -> Example2-I2C_Digital_compass.
Having a hard time seeing the image? Click the image for a closer look.
Make sure you have the correct board and port selected. For this tutorial, your selections should look something like this:
Having a hard time seeing the image? Click the image for a closer look.
Once you're ready to go, go ahead and hit the upload button (the right facing arrow button under the "Edit" menu item). Once your code is uploaded, open the Serial Monitor and you'll see compass readings start printing out.
Having a hard time seeing the image? Click the image for a closer look.
If you look at the above image, you'll see where I abruptly changed the direction the sensor was pointing.