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
- Firebeetle Board-M0 (or similar) x 1
- BMM150 Triple Axis Magnetometer Sensor x1
- Dupont Wires
Software Preparation
- Arduino IDE
- Download and install the DFRobot_BMM150_library. (About how to install the library?)
Wiring Diagram
Connect the sensor with M0(or other mainboard) as the diagram shown below.

The default address is 0x13.
Other Preparation Work
- Select getGeomagneticData.ino in the Arduino IDE.
- Burn the code into the board.
Sample Code
- Select getGeomagneticData.ino

- Burning codes into your board
Result

Was this article helpful?
