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: MPU6050 Puck mbed
Fork of cube-puck by
Diff: main.cpp
- Revision:
- 8:4244572015c6
- Parent:
- 7:4f2aaa06ff44
- Child:
- 10:3d708495b7a0
diff -r 4f2aaa06ff44 -r 4244572015c6 main.cpp
--- a/main.cpp Tue Aug 05 08:53:18 2014 +0000
+++ b/main.cpp Fri Aug 08 12:47:20 2014 +0000
@@ -66,6 +66,15 @@
}
void updateCubeDirection(void) {
+
+ if(!mpu.testConnection()) {
+ LOG_ERROR("MPU DIED! Resetting...\n");
+ mpu.reset();
+ mpu.initialize();
+ LOG_ERROR("Reset complete.\n");
+ return;
+ }
+
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
int16_t x = direction_if_exited(ax);
