4 directional EMG control of the XY table. Made during my bachelor end assignment.

Dependencies:   C12832_lcd HIDScope mbed-dsp mbed

Revision:
11:74ae4e5e11ab
Parent:
10:7f94cd65c910
Child:
12:5099e4897586
Child:
13:c4e80f6e7113
--- a/main.cpp	Tue Apr 28 10:02:45 2015 +0000
+++ b/main.cpp	Tue Apr 28 12:28:53 2015 +0000
@@ -1,6 +1,8 @@
 #include "mbed.h"
 #include "C12832_lcd.h"
 
+#define P_GAIN 0.9999
+
 DigitalOut Dir(p21);
 PwmOut Step(p22);
 DigitalOut MS1(p27);
@@ -14,7 +16,7 @@
 DigitalIn Down(p12);
 int main()
 {
-    float setpoint = 5000;
+    float setpoint = 2000; //Frequentie 
     float step_freq = 1;
     MS1 = 1;
     MS2 = 0;
@@ -28,7 +30,7 @@
         p1 = Pot1.read();
         Dir = Pot1;
         float new_step_freq;
-        new_step_freq = (0.0001*setpoint) + (0.9999*step_freq);
+        new_step_freq = ((1-P_GAIN)*setpoint) + (P_GAIN*step_freq);
         step_freq = new_step_freq;
         Step.period(1.0/step_freq);
         lcd.printf("Pot1 : %d \n", p1);