A Jedi light saber controller program with the following "features": - Using RGB LEDs - User can change light colors with a button - Motion dependent (PWM) sounds with a MPU6050 motion sensor - Low voltage detection

Dependencies:   L152RE_USBDevice STM32_USB48MHz Watchdog mbed

Revision:
1:8143972a0587
Parent:
0:0bb3687e39da
Child:
2:59a7d4677474
diff -r 0bb3687e39da -r 8143972a0587 MPU6050IMU/MPU6050.h
--- a/MPU6050IMU/MPU6050.h	Tue Mar 22 10:30:16 2016 +0000
+++ b/MPU6050IMU/MPU6050.h	Thu Mar 24 21:53:12 2016 +0000
@@ -622,7 +622,7 @@
 
             // Normalise accelerometer measurement
             norm = sqrt(ax * ax + ay * ay + az * az);
-            if (norm == 0.0f) return; // handle NaN
+            if (norm == 0.0f) return; // handle NaN (INF ???)
             norm = 1.0f/norm;
             ax *= norm;
             ay *= norm;
@@ -647,6 +647,7 @@
             
             // Normalize the gradient
             norm = sqrt(hatDot1 * hatDot1 + hatDot2 * hatDot2 + hatDot3 * hatDot3 + hatDot4 * hatDot4);
+            if (norm == 0.0f) return; // handle NaN (INF ???)
             hatDot1 /= norm;
             hatDot2 /= norm;
             hatDot3 /= norm;
@@ -679,6 +680,7 @@
 
             // Normalize the quaternion
             norm = sqrt(q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4);    // normalise quaternion
+            if (norm == 0.0f) return; // handle NaN (INF ???)
             norm = 1.0f/norm;
             q[0] = q1 * norm;
             q[1] = q2 * norm;