![](/media/cache/profiles/909f269e0b3ffbd61d906f9b25eecaf6.jpg.50x50_q85.jpg)
a hack to use buttons to fake a cube puck
Dependencies: MPU6050 Puck mbed
Fork of cube-puck by
Diff: main.cpp
- Revision:
- 8:4244572015c6
- Parent:
- 7:4f2aaa06ff44
- Child:
- 10:3d708495b7a0
--- 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);