test

Dependencies:   MPU6050 ledControl2 mbed

Files at this revision

API Documentation at this revision

Comitter:
dgu
Date:
Fri Jan 19 09:58:39 2018 +0000
Commit message:
a1

Changed in this revision

MPU6050.lib Show annotated file Show diff for this revision Revisions of this file
ledControl.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MPU6050.lib	Fri Jan 19 09:58:39 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/dgu/code/MPU6050/#5fa6b4d52805
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ledControl.lib	Fri Jan 19 09:58:39 2018 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/BaserK/code/ledControl2/#1655ee0ec2ca
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jan 19 09:58:39 2018 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+#include "MPU6050.h"
+#include "ledControl.h"
+
+Serial pc(USBTX, USBRX);  
+MPU6050 mpu6050;
+
+Ticker toggler1;
+
+void toggle_led1();
+//void toggle_led2();
+
+float pitchAngle = 0;
+float rollAngle = 0;
+float yawAngle = 0;
+
+int main() 
+{
+    pc.baud(9600);          // baud rate: 9600
+    mpu6050.whoAmI();       // Communication test: WHO_AM_I register reading 
+    wait(1);
+    mpu6050.calibrate(accelBias,gyroBias);  // Calibrate MPU6050
+    pc.printf("Calibration is completed. \r\n");
+    wait(0.5);
+    mpu6050.init();         // Initialize the sensor
+    wait(1);
+    pc.printf("MPU6050 is initialized for operation.. \r\n\r\n");
+    wait_ms(500);
+ 
+    while(1) 
+    {
+        mpu6050.complementaryFilter(&pitchAngle, &rollAngle, &yawAngle);
+        //pc.printf("%.3f,%.3f,%.3f   \r\n",pitchAngle, rollAngle,yawAngle);
+        pc.printf("%.3f,%.3f,%.3f   \r\n",ax, ay,az);
+        //wait(0.1);
+
+    }
+}
+
+void toggle_led1() {ledToggle(1);}
+//void toggle_led2() {ledToggle(2);}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Jan 19 09:58:39 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7130f322cb7e
\ No newline at end of file