This is a sample of library TI_MPU6050.

Dependencies:   TI_MPU6050 mbed

Committer:
tichise
Date:
Mon Jun 04 22:42:56 2018 +0000
Revision:
0:b122db65cd64
new

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tichise 0:b122db65cd64 1 #include "mbed.h"
tichise 0:b122db65cd64 2 #include "TI_MPU6050.h"
tichise 0:b122db65cd64 3
tichise 0:b122db65cd64 4 TI_MPU6050 mpu6050;
tichise 0:b122db65cd64 5
tichise 0:b122db65cd64 6 DigitalOut led1(LED1);
tichise 0:b122db65cd64 7
tichise 0:b122db65cd64 8 int main() {
tichise 0:b122db65cd64 9 mpu6050.setSleepEnabled(false);
tichise 0:b122db65cd64 10
tichise 0:b122db65cd64 11 while(1) {
tichise 0:b122db65cd64 12 if (mpu6050.isHorizontal()) {
tichise 0:b122db65cd64 13 led1 = 1;
tichise 0:b122db65cd64 14 } else {
tichise 0:b122db65cd64 15 led1 = 0;
tichise 0:b122db65cd64 16 }
tichise 0:b122db65cd64 17
tichise 0:b122db65cd64 18 int verticalAngle = mpu6050.getVerticalAngle();
tichise 0:b122db65cd64 19 printf("verticalAngle is %d\n\r", verticalAngle);
tichise 0:b122db65cd64 20 }
tichise 0:b122db65cd64 21 }