a hack to use buttons to fake a cube puck
Dependencies: MPU6050 Puck mbed
Fork of cube-puck by
Revision 8:4244572015c6, committed 2014-08-08
- Comitter:
- sigveseb
- Date:
- Fri Aug 08 12:47:20 2014 +0000
- Parent:
- 7:4f2aaa06ff44
- Child:
- 9:9125497a376f
- Commit message:
- Add MPU6050 failure recovery
Changed in this revision
MPU6050.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/MPU6050.lib Tue Aug 05 08:53:18 2014 +0000 +++ b/MPU6050.lib Fri Aug 08 12:47:20 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/teams/Nordic-Pucks/code/MPU6050/#8162a54451b5 +http://mbed.org/teams/Nordic-Pucks/code/MPU6050/#597a90170e5c
--- 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);