eindscript the slap

Dependencies:   Encoder HIDScope MODSERIAL TextLCD mbed-dsp mbed

Revision:
5:060d376291b5
Parent:
4:305671faeb2b
Child:
6:2c11ee0c05b4
--- a/main.cpp	Mon Nov 03 19:57:46 2014 +0000
+++ b/main.cpp	Tue Nov 04 11:02:05 2014 +0000
@@ -24,13 +24,13 @@
 #define K_I_KM (0.0003  *TSAMP)
 #define K_D_KM (0.0 /TSAMP)
 #define K_P_GM (0.0022)
-#define K_I_GM (0.0001  *TSAMP)
+#define K_I_GM (0.00005  *TSAMP)        //oud 0.0001
 #define K_D_GM (0.00000001 /TSAMP)
 #define I_LIMIT 1.
 #define RADTICKGM 0.003927
-#define THETADOT0 6.85
-#define THETADOT1 7.77
-#define THETADOT2 9.21
+#define THETADOT0 20.0      //ouid 6.85
+#define THETADOT1 11.5       //oud 7.77
+#define THETADOT2 14.00      //oud 9.21
 
 TextLCD lcd(PTD2, PTA12, PTB2, PTB3, PTC2, PTA13);
 
@@ -205,6 +205,7 @@
                 tijdtimer.stop();
                 tijdtimer.reset();
                 //pc.printf("max value %f\n\r", max_value_biceps);
+                lcd.cls();
                 wait(5);
 
                 //maximale inspanning deltoid
@@ -226,6 +227,7 @@
                 // tijdtimer.stop();
                 tijdtimer.reset();
                 //pc.printf("max value %f\n\r", max_value_deltoid);
+                lcd.cls();
                 wait(5);
 
                 state = RICHTEN;
@@ -237,14 +239,16 @@
                 lcd.cls();
                 lcd.locate(0,0);
                 lcd.printf("Richten");                  //regel 1 LCD scherm
+                lcd.cls();
                 lcd.locate(0,1);
-                pc.printf("Kies goal!");               //regel 2 LCD scherm
-                float setpointkm;
-                float new_pwm_km;
+                lcd.printf("Kies goal!");               //regel 2 LCD scherm
                 wait(5);
                 lcd.cls();
                 lcd.locate(0,0);
                 lcd.printf("Meting loopt");
+                wait(2);
+                float setpointkm;
+                float new_pwm_km;
                 float kalibratiewaarde_deltoid;
                 kalibratiewaarde_deltoid=(envelop_emg1/max_value_deltoid);
                 if (kalibratiewaarde_deltoid >= 0.35) {
@@ -285,18 +289,20 @@
                 wait(3);
                 lcd.cls();
                 lcd.locate(0,0);
-                lcd.printf("Slaan");                  //regel 1 LCD scherm
+                lcd.printf("Richten");                  //regel 1 LCD scherm
+                lcd.cls();
                 lcd.locate(0,1);
-                pc.printf("Kies goal");               //regel 2 LCD scherm
+                lcd.printf("Kies goal!");               //regel 2 LCD scherm
+                wait(5);
+                lcd.cls();
+                lcd.locate(0,0);
+                lcd.printf("Meting loopt");
+                wait(2);
                 float thetadot;
                 float setpointgm;
                 float new_pwm_gm;
                 float setpointkm;
                 float new_pwm_km;
-                wait(5);
-                lcd.cls();
-                lcd.locate(0,0);
-                lcd.printf("Meting loopt");
                 float kalibratiewaarde_biceps;
                 kalibratiewaarde_biceps=(envelop_emg0/max_value_biceps);
                 if (kalibratiewaarde_biceps <= 0.2) {                                     //kalibratiewaarde_biceps<0.2 goal onderin