3-Axis Compass Magnetometer Sensor Module GY-273 - Digital Output, I2C Interface - HMC5883L
RM21.20
- Ex Tax: RM20.00
- Product Code: GY-273
- Availability: In Stock.
Specifications
#include <Wire.h> //I2C Arduino Library #define addr 0x1E //I2C Address for The HMC5883 void setup(){ Serial.begin(9600); Wire.begin(); Wire.beginTransmission(addr); //start talking Wire.write(0x02); // Set the Register(500); }
Open the Serial Monitor and Verify Your Output.
Your output should look something like:
X Value: 200
Y Value: 191
Z Value: -356
....... etc
Once you’ve established that you have an output, try turning your device along it’s various axes and view the results.