MPU6050 simple library

Dependents:   MPU6050_test Drone MPU6050_test acelerometro ... more

Revision:
10:31cec9253c7c
Parent:
9:2dd52ac40c96
Child:
11:7cccbf912a71
--- a/MPU6050.h	Thu Aug 15 03:22:38 2019 +0000
+++ b/MPU6050.h	Thu Aug 15 03:29:07 2019 +0000
@@ -116,6 +116,33 @@
 
 /**
 *MPU6050 6 axis I2C sensor
+*
+*@code
+*#include "mbed.h"
+*#include "MPU6050.h"
+*
+*MPU6050 mpu(D7,D8);
+*
+*float gx,gy,gz,ax,ay,az;
+*
+*int main()
+*{
+*    if(mpu.getID()==0x68) {
+*        printf("MPU6050 OK");
+*        wait(1);
+*    } else {
+*        printf("MPU6050 error ID=0x%x\r\n",mpu.getID());
+*        while(1) {
+*        }
+*    }
+*    mpu.start();
+*    while(1) {
+*        mpu.read(&gx,&gy,&gz,&ax,&ay,&az);
+*        printf("gx,gy,gz,ax,ay,az %.1f,%.1f,%.1f,%.2f,%.2f,%.2f\r\n",gx,gy,gz,ax,ay,az);
+*        wait(0.1);
+*    }
+*}
+*@endcode
 */
 class MPU6050
 {