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
Diff: main.cpp
- Revision:
- 7:b65164847018
- Parent:
- 6:af164f09f963
--- 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); } }