![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Header file and functions
Diff: main.cpp
- Revision:
- 13:d66766523196
- Parent:
- 12:6efce6d008f8
--- a/main.cpp Wed Jul 03 17:56:22 2019 +0000 +++ b/main.cpp Wed Jul 03 22:09:33 2019 +0000 @@ -1,17 +1,24 @@ #include <MPU6050.h> -#include "IMU6050.h" +#include "IMUWheelchair.h" MPU6050 IMU(D14, D15); Serial pc(USBTX, USBRX, 57600); //Serial Monitor -float dataA[3]; -float* data = dataA; +float dataGyro[3]; +float *dataG = dataGyro; + +float dataYaw[3]; +float *dataY = dataYaw; + int main() { IMU.setGyroRange(MPU6050_GYRO_RANGE_500); pc.printf("Imu test connections %d\r\n", IMU.testConnection()); while(1){ - IMU.getGyro(data); - pc.printf("x: %f, y: %f, z: %f\r\n", dataA[0]*180/3.14, dataA[1]*180/3.14, dataA[2]*180/3.14); + IMU.getGyro(dataG); + // pc.printf("x: %f, y: %f, z: %f\r\n", dataGyro[0]*180/3.14, dataGyro[1]*180/3.14, dataGyro[2]*180/3.14); wait(.2); + + IMU.getAcceleroAngle(dataY); + pc.printf("x: %f, y: %f, z: %f\r\n", dataG[0], dataG[1], dataG[2]); } }