MPU6050 library using i2c interface on LPC1768 - Complementary filter is added. Now program can calculate pitch and roll angles.
Fork of MPU6050 by
Diff: MPU6050.h
- Revision:
- 2:3e0dfce73a58
- Parent:
- 1:a248e65a25cc
- Child:
- 3:a173ad187e67
--- a/MPU6050.h Mon Jul 13 13:18:34 2015 +0000 +++ b/MPU6050.h Thu Jul 16 13:56:09 2015 +0000 @@ -7,7 +7,7 @@ #include "math.h" #include "MPU6050RegDef.h" -#define PI 3.14159265359 +#define PI 3.14159265359 // This value will be used when calculating angles #define dt 0.005 // 200 Hz sampling period extern I2C i2c; // extern the i2c in order to able to use from other files @@ -15,11 +15,11 @@ /* whoAmI func uses this func, variables etc */ extern Ticker toggler1; -extern Serial ftdi; +extern Serial pc; extern DigitalOut led2; extern void toggle_led1(); -/* Sensor datas to be used in main.cpp */ +/* Sensor datas to be used in program */ extern float ax,ay,az; extern float gx,gy,gz; extern int16_t accelData[3],gyroData[3],tempData; @@ -42,6 +42,7 @@ void readGyroData(int16_t* dest); int16_t readTempData(); void calibrate(float* dest1, float* dest2); + void complementaryFilter(float* pitch, float* roll); }; #endif \ No newline at end of file