Code to find max and avg deviation, max swing, or simple readings from a still HMC6352 compass. Can be used with motors to test error from magnetic interference.

Dependencies:   HMC6352 Motordriver mbed

Fork of HMC6352_HelloWorld by Aaron Berk

Revision:
0:f9a9be860001
Child:
2:ca1d3bef09a6
--- /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);
+
+    }
+
+}