iot

Dependencies:   MPU9250 mbed-os

Revision:
0:30a995e45e2a
Child:
1:3eec9883598a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 12 18:06:49 2017 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+#include "MPU9250.h"
+
+// Serial comms
+Serial pc(USBTX, USBRX);
+
+// Sensor board library
+MPU9250 mpu = MPU9250(p26, p27);
+
+// Configuration
+bool test_comms = true;
+bool do_sensor_init = false;
+bool do_sensor_self_test = true;
+bool print_accel = true;
+bool print_gyro = true;
+
+int main () {
+    float test_result[6] = {0.0,0.0,0.0,0.0,0.0,0.0};
+    int16_t accel[3] = {0,0,0};
+    int16_t gyro[3] = {0,0,0};
+    int16_t temp = 0;
+    
+    // Test MPU connection
+    if (test_comms) {
+        uint8_t whoami = mpu.readByte(MPU9250_ADDRESS, WHO_AM_I_MPU9250);  // Read WHO_AM_I register for MPU-9250
+        pc.printf("I AM 0x%x\n\r", whoami); 
+        pc.printf("I SHOULD BE 0x71\n\r");
+        wait(1);   
+    }  
+    
+    while(1) {
+        pc.printf("Hi hi");                    
+    } 
+}
\ No newline at end of file