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

Dependencies:   C12832_lcd HIDScope mbed-dsp mbed

Files at this revision

API Documentation at this revision

Comitter:
jessekaiser
Date:
Mon Jun 22 10:04:51 2015 +0000
Parent:
74:a9281e4ae9bb
Child:
76:627b0537110e
Commit message:
Motor-x control 2;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Jun 22 08:59:46 2015 +0000
+++ b/main.cpp	Mon Jun 22 10:04:51 2015 +0000
@@ -27,15 +27,15 @@
 #define error_tresh 0.01
 
 //Motor control
-DigitalOut Dirx(p21);
-PwmOut Stepx(p22);
+DigitalOut Dirx(p25);
+PwmOut Stepx(p26);
 
 //Signal to and from computer
 Serial pc(USBTX, USBRX);
 
 //Position sensors
-AnalogIn Posx(p19);
-DigitalOut Enablex(p25);
+AnalogIn Posx(p20);
+DigitalOut Enablex(p30);
 
 //Microstepping
 DigitalOut MS1(p27);
@@ -43,8 +43,8 @@
 DigitalOut MS3(p29);
 
 //EMG inputs
-AnalogIn emg1(p15);
-AnalogIn emg2(p16);
+AnalogIn emg1(p19);
+AnalogIn emg2(p18);
 
 //HIDScope scope(4);
 //Ticker   scopeTimer;
@@ -177,7 +177,7 @@
             lcd.printf("%.2f  \n", Stepx.read());
 
 
-            if (Ps_x < 0.50 && errorx > error_tresh) {
+            if (Ps_x < 0.83 && errorx > error_tresh) {
                 Dirx = 0;
                 cx = errorx * H_Gain;
                 float hnew_step_freqx;
@@ -187,7 +187,7 @@
                 wait(0.01);
             }
 
-            if (Ps_x > 0.50 && errorx > error_tresh) {
+            if (Ps_x > 0.83 && errorx > error_tresh) {
                 Dirx = 1;
                 cx = errorx * H_Gain;
                 float hnew_step_freqx;