satoshi shimada
/
mbed_mpu6050_i2c_raw_register
MPU-6050 sample code
Diff: main.cpp
- Revision:
- 3:ebd656a9c89f
- Parent:
- 2:f2db52a742b0
diff -r f2db52a742b0 -r ebd656a9c89f main.cpp --- a/main.cpp Thu Dec 13 03:07:35 2018 +0000 +++ b/main.cpp Thu Dec 13 15:35:41 2018 +0000 @@ -8,7 +8,7 @@ DigitalOut led4(LED4); MPU6050 mpu(p9, p10); -void allTurnOffLed() +void turnOffAllLed() { led1 = 0; led2 = 0; @@ -23,7 +23,7 @@ double gx, gy, gz; mpu.readGyroscope(gx, gy, gz); pc.printf("%.4lf %.4lf %.4lf %.4lf %.4lf %.4lf\r\n", ax, ay, az, gx, gy, gz); - allTurnOffLed(); + turnOffAllLed(); if(ax > ay && ax > az) { led1 = 1; } else if(ay > ax && ay > az) { @@ -36,8 +36,9 @@ } int main() { + pc.baud(115200); mpu.setMaxScale(MAX_ACC_8G, MAX_GYRO_1000degpersec); - while(1) { + while(true) { readData(); wait(0.2); }