Example Code for M0-get geomagnetic data and compass angle

Last revision 2026/01/21

Get the geomagnetic data of the 3 axes and the compass angle.

Hardware Preparation

Software Preparation

Wiring Diagram

Connect the sensor with M0(or other mainboard) as the diagram shown below.

Connection M0

The default address is 0x13.

Other Preparation Work

  1. Select getGeomagneticData.ino in the Arduino IDE.
  2. Burn the code into the board.

Sample Code

  • Select getGeomagneticData.ino

Sample 2

  • Burning codes into your board

Result

Result 2

Was this article helpful?

TOP