a
main.cpp@16:caf587f09e34, 2019-07-09 (annotated)
- Committer:
- isagmz
- Date:
- Tue Jul 09 23:33:28 2019 +0000
- Revision:
- 16:caf587f09e34
- Parent:
- 15:b7cac36c4cce
IMU
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jahutchi | 12:6efce6d008f8 | 1 | #include <MPU6050.h> |
jahutchi | 13:d66766523196 | 2 | #include "IMUWheelchair.h" |
sepham | 14:365c1c1bf6ee | 3 | //MPU6050 IMU(D14, D15); |
isagmz | 16:caf587f09e34 | 4 | Serial pc(USBTX, USBRX, 57600); //Serial Monitor |
jahutchi | 13:d66766523196 | 5 | float dataGyro[3]; |
jahutchi | 13:d66766523196 | 6 | float *dataG = dataGyro; |
sepham | 14:365c1c1bf6ee | 7 | Timer t; |
jahutchi | 13:d66766523196 | 8 | float dataYaw[3]; |
jahutchi | 13:d66766523196 | 9 | float *dataY = dataYaw; |
sepham | 14:365c1c1bf6ee | 10 | IMUWheelchair IMU(&pc,&t); |
jahutchi | 13:d66766523196 | 11 | |
jahutchi | 12:6efce6d008f8 | 12 | int main() |
jahutchi | 12:6efce6d008f8 | 13 | { |
sepham | 14:365c1c1bf6ee | 14 | t.start(); |
sepham | 14:365c1c1bf6ee | 15 | //pc.printf("Imu test connections %d\r\n", IMU.testConnection()); |
jahutchi | 12:6efce6d008f8 | 16 | while(1){ |
jahutchi | 12:6efce6d008f8 | 17 | |
sepham | 14:365c1c1bf6ee | 18 | //IMU.getGyro(dataG); |
jahutchi | 13:d66766523196 | 19 | // 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); |
sepham | 14:365c1c1bf6ee | 20 | //IMU.gyro_x(); |
sepham | 14:365c1c1bf6ee | 21 | // IMU.getAcceleroAngle(dataY); |
sepham | 14:365c1c1bf6ee | 22 | // pc.printf("x: %f, y: %f, z: %f\r\n", dataG[0]*180/3.1415926 + .79, dataG[1], dataG[2]); |
sepham | 14:365c1c1bf6ee | 23 | // printf("%f, %f, %f\n", IMU.gyro_x(), IMU.gyro_y(), IMU.gyro_z()); |
sepham | 14:365c1c1bf6ee | 24 | // printf("%f\r\n ", IMU.accel_x()); |
sepham | 14:365c1c1bf6ee | 25 | |
isagmz | 16:caf587f09e34 | 26 | pc.printf("%f\r\n", IMU.gyro_x()); |
sepham | 14:365c1c1bf6ee | 27 | // printf("%f\r\n ", IMU.yaw()); |
jahutchi | 12:6efce6d008f8 | 28 | } |
jahutchi | 12:6efce6d008f8 | 29 | } |