calculate

Dependencies:   mbed X_NUCLEO_IKS01A3 Mahony_Algorithm

Revision:
1:48e219526d0f
Parent:
0:313fbc3a198a
Child:
2:4cccdc792719
--- a/main.cpp	Wed Apr 01 16:47:06 2020 +0000
+++ b/main.cpp	Mon Apr 13 09:37:17 2020 +0000
@@ -28,22 +28,31 @@
 
 //initialise DigitalIO
 DigitalOut myled(LED1);
-DigitalOut enable(PB_15);
-DigitalIn leftsensor(PA_0);
 DigitalIn user_button(USER_BUTTON);
 
 
 //Generate object
 CalculateData calculate(D14, D15, D4, D5, A3, D6, A4);
 
+int pos[3];
+int speed[3];
+int acc[3];
 
 int main(){
-    wait(4);
     calculate.enable();
-    wait(8);
-    calculate.disable();
-    
-    
+    while(1){    
+        calculate.run();
+        calculate.getAccelerometer(acc);
+        calculate.getSpeed(speed);
+        calculate.getPosition(pos);
+        
+        printf("\r\n----------\r\n\n");
+        printf("Accelerometer: \t%5.2f\t%5.2f\t%5.2f\r\n",(double)acc[0], (double)acc[1], (double)acc[2]);
+        printf("Speed: \t%5.2f\t%5.2f\t%5.2f\r\n",(speed[0]*9.81)/1000, (speed[1]*9.81)/1000, (speed[2]*9.81)/1000);
+        printf("pos: \t%5.2f\t%5.2f\t%5.2f\r\n",(pos[0]*9.81)/1000, (pos[1]*9.81)/1000, (pos[2]*9.81)/1000);
+        printf("\r\n----------\r\n\n");
+        wait_ms(500);
+    }
 }