Dependencies:   BNO055_fusion_tom FastPWM mbed

Fork of NucleoCube1 by Will Church

Revision:
10:69eb22acaea3
Parent:
9:6a83e2777d24
Child:
13:e41d32a48931
--- a/main.cpp	Sun Apr 09 19:52:02 2017 +0000
+++ b/main.cpp	Sun Apr 09 19:56:14 2017 +0000
@@ -28,8 +28,8 @@
     
     //BNO055_EULER_TypeDef  velocity;  IN PROGRESS
 
-double Kbt = .54;
-double Kbv = 0.23;
+double Kbt = 5.4;
+double Kbv = 0.33;
 double Kwv = 0.124;
 double r1;
 
@@ -41,6 +41,14 @@
     
     r1 = (Kbt*euler_angles.h*3.14/180.0);
     r1 = (r1 + 6.0)/12.0 ;              //Normalize for PWM output
+    
+    //Limit PWM range
+    if (r1 > 1.0){
+        r1 = 1.0;
+        }
+    if (r1 < 0.0){
+        r1 = 0.0;
+        }
     P1 = r1; 
     //P2 = (euler_angles.r/360.0);
     //P3 = (euler_angles.p/360.0);