Aaron Berk
/
HMC6352_HelloWorld
Honeywell HMC6352 digital compass example.
Diff: main.cpp
- Revision:
- 0:f9a9be860001
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Aug 26 10:54:06 2010 +0000 @@ -0,0 +1,21 @@ +#include "HMC6352.h" + +HMC6352 compass(p9, p10); +Serial pc(USBTX, USBRX); + +int main() { + + pc.printf("Starting HMC6352 test...\n"); + + //Continuous mode, periodic set/reset, 20Hz measurement rate. + compass.setOpMode(HMC6352_CONTINUOUS, 1, 20); + + while (1) { + + wait(0.1); + + pc.printf("Heading is: %f\n", compass.sample() / 10.0); + + } + +}