j

Revision:
1:dc9389ccc09d
Parent:
0:d861e7a56281
--- a/main.cpp	Sun Aug 25 08:58:34 2019 +0000
+++ b/main.cpp	Wed Sep 11 12:15:15 2019 +0000
@@ -1,20 +1,25 @@
-#include <bma220.h>
+#include "mbed.h"
+#include "math.h"
+#include "bma220.h"
+#include "thermistor.h"
 
-BMA220 Sensor;
 Serial pc(USBTX, USBRX);
+AnalogIn ain(A0);
 
 void display(Quanterion Q){
-    pc.printf("%f+ %fi+ %fj+ %fk \t ANgle is: %f\n",Q.q0, Q.q1, Q.q2, Q.q3, Q.angle);
+    pc.printf("%f+ %fi+ %fj+ %fk \t Angle is: %f\n",Q.q0, Q.q1, Q.q2, Q.q3, Q.angle);
 }
 
 int main() {
     pc.baud(115200);
+    
+    I2C i2c(I2C_SDA, I2C_SCL);
+    i2c.frequency(400000);
+    BMA220 Sensor(&i2c);
+    Thermistor thermistor(&ain);
+    
     if (!Sensor.begin()) {
         pc.printf("No valid BMA220 sensor found, check wiring");
-        while (true){  // stop here, no reason to go on...
-            pc.printf("Nothing...\n");
-            wait(5);
-        }
     }
     // Set sensor sensitivity to 4g
     Sensor.setRegister(SENSITIVITY_REG, SENS_2g);
@@ -44,9 +49,6 @@
         display(Sensor.Q_result1);
         display(Sensor.Q_result2);
         
-    //    pc.printf(Sensor.getRoll());
-    //    pc.printf("/");
-    //    pc.printf(Sensor.getPitch());
         wait(1);
-    }
+    }   
 }
\ No newline at end of file