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.
Dependencies: mbed MPU6050_testAAAAAAAAAAAAA
main.cpp
- Committer:
- ritarosakai
- Date:
- 2019-08-15
- Revision:
- 2:6e9393d9cc11
- Parent:
- 1:01af59327884
- Child:
- 3:0c4d924ea29b
File content as of revision 2:6e9393d9cc11:
#include "mbed.h" #include "MPU6050.h" MPU6050 mpu(D4,D5); Serial pc(USBTX,USBRX); float gx,gy,gz,ax,ay,az; int main() { pc.baud(115200); if(mpu.getID()==0x68) { pc.printf("MPU6050 OK"); wait(1); } else { pc.printf("MPU6050 error ID=0x%x\r\n",mpu.getID()); while(1) { } } mpu.start(); while(1) { mpu.read(&gx,&gy,&gz,&ax,&ay,&az); pc.printf("gx,gy,gz,ax,ay,az %.1f,%.1f,%.1f,%.2f,%.2f,%.2f\r\n",gx,gy,gz,ax,ay,az); wait(0.1); } }