a
main.cpp@13:d66766523196, 2019-07-03 (annotated)
- Committer:
- jahutchi
- Date:
- Wed Jul 03 22:09:33 2019 +0000
- Revision:
- 13:d66766523196
- Parent:
- 12:6efce6d008f8
- Child:
- 14:365c1c1bf6ee
Functions are working but now figuring out the yaw
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" |
jahutchi | 12:6efce6d008f8 | 3 | MPU6050 IMU(D14, D15); |
jahutchi | 12:6efce6d008f8 | 4 | Serial pc(USBTX, USBRX, 57600); //Serial Monitor |
jahutchi | 13:d66766523196 | 5 | float dataGyro[3]; |
jahutchi | 13:d66766523196 | 6 | float *dataG = dataGyro; |
jahutchi | 13:d66766523196 | 7 | |
jahutchi | 13:d66766523196 | 8 | float dataYaw[3]; |
jahutchi | 13:d66766523196 | 9 | float *dataY = dataYaw; |
jahutchi | 13:d66766523196 | 10 | |
jahutchi | 12:6efce6d008f8 | 11 | int main() |
jahutchi | 12:6efce6d008f8 | 12 | { |
jahutchi | 12:6efce6d008f8 | 13 | IMU.setGyroRange(MPU6050_GYRO_RANGE_500); |
jahutchi | 12:6efce6d008f8 | 14 | pc.printf("Imu test connections %d\r\n", IMU.testConnection()); |
jahutchi | 12:6efce6d008f8 | 15 | while(1){ |
jahutchi | 12:6efce6d008f8 | 16 | |
jahutchi | 13:d66766523196 | 17 | IMU.getGyro(dataG); |
jahutchi | 13:d66766523196 | 18 | // 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); |
jahutchi | 12:6efce6d008f8 | 19 | wait(.2); |
jahutchi | 13:d66766523196 | 20 | |
jahutchi | 13:d66766523196 | 21 | IMU.getAcceleroAngle(dataY); |
jahutchi | 13:d66766523196 | 22 | pc.printf("x: %f, y: %f, z: %f\r\n", dataG[0], dataG[1], dataG[2]); |
jahutchi | 12:6efce6d008f8 | 23 | } |
jahutchi | 12:6efce6d008f8 | 24 | } |