This program is designed to run on a set of Xadow M0 modules to create a Hotshoe IMU which outputs GPS and Orientation data to Nikon cameras, as well as triggering the camera at set intervals.

Dependencies:   MBed_Adafruit-GPS-Library SC16IS750 SDFileSystem SSD1308_128x64_I2C USBDevice mbed BMP085

Fork of MPU9150AHRS by Kris Winer

/media/uploads/whatnick/20151022_004759.jpg

Revision:
9:b7062c55d36c
Parent:
7:37bd00805530
Child:
10:46b5acee9472
--- a/main.cpp	Tue Dec 01 02:03:48 2015 +0000
+++ b/main.cpp	Tue Dec 01 04:42:30 2015 +0000
@@ -66,7 +66,6 @@
 #ifdef DEBUG
 #include "USBSerial.h"                       // To use USB virtual serial, a driver is needed, check http://mbed.org/handbook/USBSerial
 #define LOG(args...)    pc.printf(args)
-USBSerial pc;
 #else
 #define LOG(args...)
 #endif
@@ -187,6 +186,10 @@
         MPU9150.initMPU9150();
         LOG("MPU9150 initialized for active data mode....\n\r"); // Initialize device for active mode read of acclerometer, gyroscope, and temperature
         MPU9150.initAK8975A(magCalibration);
+        oled.writeString(2,0,"Mag Cal, wave 8");
+        MPU9150.magcalMPU9150(magBias);
+        oled.writeString(2,0,"Mag Cal done   ");
+        wait(1);
         LOG("AK8975 initialized for active data mode....\n\r"); // Initialize device for active mode read of magnetometer
     } else {
         LOG("Could not connect to MPU9150: \n\r");
@@ -207,12 +210,9 @@
     mRes = 10.*1229./4096.; // Conversion from 1229 microTesla full scale (4096) to 12.29 Gauss full scale
     // So far, magnetometer bias is calculated and subtracted here manually, should construct an algorithm to do it automatically
     // like the gyro and accelerometer biases
-    magbias[0] = -5.;   // User environmental x-axis correction in milliGauss
-    magbias[1] = -95.;  // User environmental y-axis correction in milliGauss
-    magbias[2] = -260.; // User environmental z-axis correction in milliGauss
-
+    
     //Wait for GPS to acquire lock
-    oled.writeString(2,0,"GPS Simul ");
+    oled.writeString(2,0,"GPS Waiting...");
     while(!myGPS.fix) {
         c = myGPS.read();   //queries the GPS
         if (c) {