Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 13:d66766523196
- Parent:
- 12:6efce6d008f8
diff -r 6efce6d008f8 -r d66766523196 main.cpp --- 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]); } }