Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "MPU6050.h" 00003 00004 MPU6050 mpu(D4,D5); 00005 Serial pc(USBTX,USBRX); 00006 00007 float gx,gy,gz,ax,ay,az; 00008 00009 int main() 00010 { 00011 pc.baud(115200); 00012 if(mpu.getID()==0x68) { 00013 pc.printf("MPU6050 OK"); 00014 wait(1); 00015 } else { 00016 pc.printf("MPU6050 error ID=0x%x\r\n",mpu.getID()); 00017 while(1) { 00018 } 00019 } 00020 mpu.start(); 00021 while(1) { 00022 mpu.read(&gx,&gy,&gz,&ax,&ay,&az); 00023 pc.printf("gx,gy,gz,ax,ay,az %.1f,%.1f,%.1f,%.2f,%.2f,%.2f\r\n",gx,gy,gz,ax,ay,az); 00024 wait(0.1); 00025 } 00026 }
Generated on Wed Jul 20 2022 08:41:01 by
1.7.2