Alle subfiles samengevoegd

Dependencies:   HIDScope biquadFilter mbed MODSERIAL FastPWM QEI

Files at this revision

API Documentation at this revision

Comitter:
sjoerdbarts
Date:
Wed Nov 02 11:24:07 2016 +0000
Parent:
19:3af738c38db0
Commit message:
Final code

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Nov 02 11:01:23 2016 +0000
+++ b/main.cpp	Wed Nov 02 11:24:07 2016 +0000
@@ -58,7 +58,7 @@
 
 // Set initial Kp and Ki
 volatile double Kp = 0.05; // last known good Kp: 0.02
-volatile double Ki = 0.015;   // last known good Ki: 0.0025
+volatile double Ki = 0.025;   // last known good Ki: 0.0025
 volatile double Kd = 0.0; // last known good Kd: 0.0
 
 // Set frequencies for sampling, calc and control.
@@ -319,7 +319,8 @@
 {
     // calc steps in mm
     double Step = Speed/CALC_F ;  //10 mm per seconde afleggen
-    
+    int Ymax = 306;
+    int Xmax = 200;
     if (BicepsLeft==true && BicepsRight==true && Leg==true && Stepper_State==false) {   
         Stepper_On();
     }
@@ -339,14 +340,14 @@
     }
     
     // Grenswaardes     LET OP: ARMEN MISSCHIEN GEBLOKKEERD DOOR BALK AAN DE BINNENKANT
-    if (x > 200) {
-        x = 200;
+    if (x > Xmax) {
+        x = Xmax;
     }
-    else if (x < -200) {
-        x = -200;
+    else if (x < -Xmax) {
+        x = -Xmax;
     }
-    if (y > 306) {
-        y = 306;
+    if (y > Ymax) {
+        y = Ymax;
     }
     else if (y < 50) {
         y = 50;         // GOKJE, UITPROBEREN