Added for gyro and testing

Committer:
sepham
Date:
Thu Jul 04 18:25:35 2019 +0000
Revision:
14:365c1c1bf6ee
Parent:
13:d66766523196
IMU tof more gyro and testing

Who changed what in which revision?

UserRevisionLine numberNew 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);
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;
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);
jahutchi 12:6efce6d008f8 20 wait(.2);
sepham 14:365c1c1bf6ee 21 //IMU.gyro_x();
sepham 14:365c1c1bf6ee 22 // IMU.getAcceleroAngle(dataY);
sepham 14:365c1c1bf6ee 23 // pc.printf("x: %f, y: %f, z: %f\r\n", dataG[0]*180/3.1415926 + .79, dataG[1], dataG[2]);
sepham 14:365c1c1bf6ee 24 // printf("%f, %f, %f\n", IMU.gyro_x(), IMU.gyro_y(), IMU.gyro_z());
sepham 14:365c1c1bf6ee 25 // printf("%f\r\n ", IMU.accel_x());
sepham 14:365c1c1bf6ee 26
sepham 14:365c1c1bf6ee 27 IMU.yaw();
sepham 14:365c1c1bf6ee 28 // printf("%f\r\n ", IMU.yaw());
jahutchi 12:6efce6d008f8 29 }
jahutchi 12:6efce6d008f8 30 }