test program

Dependencies:   ledControl2 mbed

Fork of i2c_MPU6050 by Baser Kandehir

Revision:
8:7054024a3c09
Parent:
7:3e1e78b34e1a
diff -r 3e1e78b34e1a -r 7054024a3c09 main.cpp
--- a/main.cpp	Wed Aug 05 13:15:31 2015 +0000
+++ b/main.cpp	Thu Nov 12 17:34:19 2015 +0000
@@ -73,6 +73,8 @@
 
 float pitchAngle = 0;
 float rollAngle = 0;
+float yawAngle = 0;
+int count=1;
 
 int main() 
 {
@@ -89,7 +91,7 @@
     
     while(1) 
     {
-     
+     count++;
      /* Uncomment below if you want to see accel and gyro data */
         
 //        pc.printf(" _____________________________________________________________  \r\n");
@@ -101,12 +103,11 @@
                 
         filter.attach(&compFilter, 0.005);    // Call the complementaryFilter func. every 5 ms (200 Hz sampling period)
         
-        pc.printf(" _______________\r\n");
-        pc.printf("| Pitch: %.3f   \r\n",pitchAngle);
-        pc.printf("| Roll:  %.3f   \r\n",rollAngle);
-        pc.printf("|_______________\r\n\r\n");
+        pc.printf("| Pitch: %.3f   ",pitchAngle);
+        pc.printf("| Roll:  %.3f   ",rollAngle);
+        pc.printf("| yaw:   %.3f |  \n",yawAngle);
         
-        wait(1);
+        wait_ms(100);
      
     }
 }
@@ -115,4 +116,4 @@
 void toggle_led2() {ledToggle(2);}
 
 /* This function is created to avoid address error that caused from Ticker.attach func */ 
-void compFilter() {mpu6050.complementaryFilter(&pitchAngle, &rollAngle);}
+void compFilter() {mpu6050.complementaryFilter(&pitchAngle, &rollAngle, &yawAngle, count);}