You are viewing an older revision! See the latest version
HMC6352 Digital Compass
The HMC6352 is a digital compass with an I2C interface.
Hello World!¶
Import program
00001 #include "HMC6352.h" 00002 00003 HMC6352 compass(p9, p10); 00004 Serial pc(USBTX, USBRX); 00005 00006 int main() { 00007 00008 pc.printf("Starting HMC6352 test...\n"); 00009 00010 //Continuous mode, periodic set/reset, 20Hz measurement rate. 00011 compass.setOpMode(HMC6352_CONTINUOUS, 1, 20); 00012 00013 while (1) { 00014 00015 wait(0.1); 00016 00017 pc.printf("Heading is: %f\n", compass.sample() / 10.0); 00018 00019 } 00020 00021 }
Wiring¶
| HMC6352 Signal Name | mbed pin |
| Vcc | Vout |
| Gnd | Gnd |
| SCL | p27 |
| SDA | p28 |
API¶
[Not found]
Library¶
[Not found]