Software
Step 1. Download the library [https://github.com/Seeed-
Studio/Grove_3_Axis_Compass_V2.0_BMM150] from Github.
Step 2. Refer How to install library
[http://wiki.seeedstudio.com/How_to_install_Arduino_Library] to install library for
Arduino.
Step 3. Create a new Arduino sketch and paste the codes below to it or open the
code directly by the path: File->Examples-
>Grove_3_Axis_Compass_V2.0_BMM150-master->compass
Here is the code
Please plug the USB cable gently, otherwise you may damage the interface.Please use the USB
cable with 4 wires inside, the 2 wires cable can't transfer data. If you are not sure about the wire
you have, you can click here [https://www.seeedstudio.com/Micro-USB-Cable-48cm-p-
1475.html] to buy
/**
* This example
*/
#include <Arduino.h>
#include <Wire.h>
// libraries
#include "bmm150.h"
#include "bmm150_defs.h"
BMM150 bmm = BMM150();
void setup()
{
Serial.begin(9600);
if(bmm.initialize() == BMM150_E_ID_NOT_CONFORM) {
Serial.println("Chip ID can not read!");
while(1);
} else {
Serial.println("Initialize done!");
}