This is a one axis gimbal control program that takes roll angle from an IMU and moves the gimbal brushless motor accordingly.

Dependencies:   MPU6050 brushlessController_TB6612FNG ledControl2 mbed

Files at this revision

API Documentation at this revision

Comitter:
BaserK
Date:
Wed Aug 05 12:49:18 2015 +0000
Parent:
6:af164f09f963
Commit message:
i2c object is not extern anymore

Changed in this revision

MPU6050.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
diff -r af164f09f963 -r b65164847018 MPU6050.lib
--- a/MPU6050.lib	Wed Jul 22 14:03:32 2015 +0000
+++ b/MPU6050.lib	Wed Aug 05 12:49:18 2015 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/BaserK/code/MPU6050/#a173ad187e67
+https://developer.mbed.org/users/BaserK/code/MPU6050/#5bff0edcdff8
diff -r af164f09f963 -r b65164847018 main.cpp
--- a/main.cpp	Wed Jul 22 14:03:32 2015 +0000
+++ b/main.cpp	Wed Aug 05 12:49:18 2015 +0000
@@ -74,7 +74,6 @@
 int main()
 {
     pc.baud(9600);                               // baud rate: 9600
-    i2c.frequency(400000);                       // fast i2c: 400 kHz
     mpu6050.whoAmI();                            // Communication test: WHO_AM_I register reading 
     mpu6050.calibrate(accelBias,gyroBias);       // Calibrate MPU6050 and load biases into bias registers
     pc.printf("Calibration is completed. \r\n"); 
@@ -85,8 +84,8 @@
     gimbal.attach(&gimbalPID,  0.005);       // Same period with gimbalPID (important)  
     while(1)
     {          
-     /*   pc.printf("%.1f,%.1f\r\n",rollAngle,pitchAngle);
-        wait_ms(40);*/
+        pc.printf("%.1f,%.1f\r\n",rollAngle,pitchAngle);
+        wait_ms(40);
     }    
 }