College Project

Dependencies:   mbed MPU9250_SPI_Test MPU9250-XCLIN

Revision:
1:7497c7952470
Parent:
0:58f9d4556df7
Child:
2:6de3660a1f92
--- a/main.cpp	Wed Jun 25 15:43:17 2014 +0000
+++ b/main.cpp	Sun Jun 29 06:39:48 2014 +0000
@@ -8,29 +8,35 @@
 int main(){
     pc.baud(115200);
     if(imu.init(1,BITS_DLPF_CFG_5HZ)){  //INIT the mpu9250
-        printf("\nCouldn't initialize MPU6000 via SPI!");
+        printf("\nCouldn't initialize MPU9250 via SPI!");
     }    
-    wait(0.1);    
     printf("\n\nWHOAMI=%u\n",imu.whoami()); //output the I2C address to know if SPI is working, it should be 104
-    wait(0.1);    
+    wait(1);    
     printf("\nGyro_scale=%u\n",imu.set_gyro_scale(BITS_FS_2000DPS));    //Set full scale range for gyros
     wait(1);  
     printf("\nAcc_scale=%u\n",imu.set_acc_scale(BITS_FS_16G));          //Set full scale range for accs
-    wait(0.1);    
+    wait(1);
+    printf("\n\nWHIAM=%u\n",imu.AK8963_whoami());
+    wait(0.1);  
     while(1) {
         //myled = 1;
         wait(0.1);
         imu.read_temp();
         imu.read_acc();
         imu.read_rot();
-        printf("%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\n", 
+        imu.AK8963_read_Magnetometer();
+        printf("%9.3f,%9.3f,%9.3f,%9.3f,%9.3f,%9.3f,%9.3f,%9.3f,%9.3f,%9.3f\n", 
             imu.Temperature,
             imu.gyroscope_data[0],
             imu.gyroscope_data[1],
             imu.gyroscope_data[2],
             imu.accelerometer_data[0],
             imu.accelerometer_data[1],
-            imu.accelerometer_data[2]);
+            imu.accelerometer_data[2],
+            imu.Magnetometer[0],
+            imu.Magnetometer[1],
+            imu.Magnetometer[2]
+            );
         //myled = 0;
         //wait(0.5);