Library receiving values from MPU6050
- include "mbed.h"
- include "TI_MPU6050.h"
Example
include the mbed library with this snippet
TI_MPU6050 mpu6050; DigitalOut led1(LED1); int main() { mpu6050.setSleepEnabled(false); while(1) { if (mpu6050.isHorizontal()) { led1 = 1; } else { led1 = 0; } int verticalAngle = mpu6050.getVerticalAngle(); printf("verticalAngle is %d\n\r", verticalAngle); } }
Diff: TI_MPU6050.h
- Revision:
- 1:bc1e8a435c95
- Parent:
- 0:81e5563b1ea1
diff -r 81e5563b1ea1 -r bc1e8a435c95 TI_MPU6050.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TI_MPU6050.h Mon Jun 04 22:41:56 2018 +0000 @@ -0,0 +1,19 @@ +#ifndef MBED_TI_MPU6050_H +#define MBED_TI_MPU6050_H + +#include "mbed.h" +#include "MPU6050.h" // https://os.mbed.com/users/garfieldsg/code/MPU6050/ + +class TI_MPU6050 +{ +public: + TI_MPU6050(); + int getVerticalAngle(); + bool isHorizontal(); + void setSleepEnabled(bool enabled); + +private: + MPU6050 _mpu; +}; + +#endif