![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Added for gyro and testing
main.cpp@12:6efce6d008f8, 2019-07-03 (annotated)
- Committer:
- jahutchi
- Date:
- Wed Jul 03 17:56:22 2019 +0000
- Revision:
- 12:6efce6d008f8
- Child:
- 13:d66766523196
IMU6050
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jahutchi | 12:6efce6d008f8 | 1 | #include <MPU6050.h> |
jahutchi | 12:6efce6d008f8 | 2 | #include "IMU6050.h" |
jahutchi | 12:6efce6d008f8 | 3 | MPU6050 IMU(D14, D15); |
jahutchi | 12:6efce6d008f8 | 4 | Serial pc(USBTX, USBRX, 57600); //Serial Monitor |
jahutchi | 12:6efce6d008f8 | 5 | float dataA[3]; |
jahutchi | 12:6efce6d008f8 | 6 | float* data = dataA; |
jahutchi | 12:6efce6d008f8 | 7 | int main() |
jahutchi | 12:6efce6d008f8 | 8 | { |
jahutchi | 12:6efce6d008f8 | 9 | IMU.setGyroRange(MPU6050_GYRO_RANGE_500); |
jahutchi | 12:6efce6d008f8 | 10 | pc.printf("Imu test connections %d\r\n", IMU.testConnection()); |
jahutchi | 12:6efce6d008f8 | 11 | while(1){ |
jahutchi | 12:6efce6d008f8 | 12 | |
jahutchi | 12:6efce6d008f8 | 13 | IMU.getGyro(data); |
jahutchi | 12:6efce6d008f8 | 14 | 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); |
jahutchi | 12:6efce6d008f8 | 15 | wait(.2); |
jahutchi | 12:6efce6d008f8 | 16 | } |
jahutchi | 12:6efce6d008f8 | 17 | } |