Sheila Pham
/
IMU6050Ver1
Added for gyro and testing
Diff: main.cpp
- Revision:
- 14:365c1c1bf6ee
- Parent:
- 13:d66766523196
--- a/main.cpp Wed Jul 03 22:09:33 2019 +0000 +++ b/main.cpp Thu Jul 04 18:25:35 2019 +0000 @@ -1,24 +1,30 @@ #include <MPU6050.h> #include "IMUWheelchair.h" -MPU6050 IMU(D14, D15); +//MPU6050 IMU(D14, D15); Serial pc(USBTX, USBRX, 57600); //Serial Monitor float dataGyro[3]; float *dataG = dataGyro; - +Timer t; float dataYaw[3]; float *dataY = dataYaw; +IMUWheelchair IMU(&pc,&t); int main() { - IMU.setGyroRange(MPU6050_GYRO_RANGE_500); - pc.printf("Imu test connections %d\r\n", IMU.testConnection()); + t.start(); + //pc.printf("Imu test connections %d\r\n", IMU.testConnection()); while(1){ - IMU.getGyro(dataG); + //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]); + //IMU.gyro_x(); + // IMU.getAcceleroAngle(dataY); + // pc.printf("x: %f, y: %f, z: %f\r\n", dataG[0]*180/3.1415926 + .79, dataG[1], dataG[2]); + // printf("%f, %f, %f\n", IMU.gyro_x(), IMU.gyro_y(), IMU.gyro_z()); + // printf("%f\r\n ", IMU.accel_x()); + + IMU.yaw(); + // printf("%f\r\n ", IMU.yaw()); } }