Isabella Gomez Torres / Mbed OS IMU6050
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include <MPU6050.h>
00002 #include "IMU6050.h"
00003 MPU6050 IMU(D14, D15);
00004 Serial pc(USBTX, USBRX, 57600);                                     //Serial Monitor
00005 float dataA[3];
00006 float* data = dataA;
00007 int main()
00008 {
00009     IMU.setGyroRange(MPU6050_GYRO_RANGE_500);
00010     pc.printf("Imu test connections %d\r\n", IMU.testConnection());
00011     while(1){
00012         
00013         IMU.getGyro(data);
00014         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);
00015         wait(.2);
00016     }
00017 }