Sheila Pham
/
IMU6050Ver1
Added for gyro and testing
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include <MPU6050.h> 00002 #include "IMUWheelchair.h" 00003 //MPU6050 IMU(D14, D15); 00004 Serial pc(USBTX, USBRX, 57600); //Serial Monitor 00005 float dataGyro[3]; 00006 float *dataG = dataGyro; 00007 Timer t; 00008 float dataYaw[3]; 00009 float *dataY = dataYaw; 00010 IMUWheelchair IMU(&pc,&t); 00011 00012 int main() 00013 { 00014 t.start(); 00015 //pc.printf("Imu test connections %d\r\n", IMU.testConnection()); 00016 while(1){ 00017 00018 //IMU.getGyro(dataG); 00019 // 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); 00020 wait(.2); 00021 //IMU.gyro_x(); 00022 // IMU.getAcceleroAngle(dataY); 00023 // pc.printf("x: %f, y: %f, z: %f\r\n", dataG[0]*180/3.1415926 + .79, dataG[1], dataG[2]); 00024 // printf("%f, %f, %f\n", IMU.gyro_x(), IMU.gyro_y(), IMU.gyro_z()); 00025 // printf("%f\r\n ", IMU.accel_x()); 00026 00027 IMU.yaw(); 00028 // printf("%f\r\n ", IMU.yaw()); 00029 } 00030 }
Generated on Sat Jul 16 2022 12:46:53 by 1.7.2