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:
Thu Jun 18 11:24:51 2015 +0000
Parent:
64:5a66361c8318
Child:
66:c094d1868b30
Commit message:
Homing 4;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Jun 18 11:19:10 2015 +0000
+++ b/main.cpp	Thu Jun 18 11:24:51 2015 +0000
@@ -214,19 +214,21 @@
 {
     // Attach the HIDScope::send method from the scope object to the timer at 500Hz. Hier wordt de sample freq aangegeven.
     // scopeTimer.attach_us(&scope, &HIDScope::send, 2e3);
-    //while(1) {
     MS1 = 1;
     MS2 = 0;
     MS3 = 0;
-    //Diry = 1;
-    //Dirx = 1;
     Stepx.write(0.5); // Duty cycle of 50%
     Stepy.write(0.5);
-    //Stepx.period(1/1500);
-    //wait(0.01);
-    //Stepy.period(1/1500);
-    //wait(0.01);
-    //}
+
+    /*while(1) {
+
+        Diry = 1;
+        Dirx = 1;
+        Stepx.period(1/1500);
+        wait(0.01);
+        Stepy.period(1/1500);
+        wait(0.01);
+    }*/
     Enablex = 1;
     Enabley = 1;
     wait(1);
@@ -237,10 +239,11 @@
     Enablex = 0;
     Enabley = 0;
     while(errorx > 2 && errory > 2) {
-        lcd.printf("%.2f %.2f  \n", Ps_x, Ps_y);
+        
 
         Ps_x = Posx.read()* 50;
         Ps_y = Posy.read()* 40;
+        lcd.printf("%.1f %.1f  \n", Ps_x, Ps_y);
 
         if (Ps_x < 44) {
             Dirx = 0;
@@ -252,9 +255,7 @@
             hstep_freqx = hnew_step_freqx;
             Stepx.period(1.0/hstep_freqx);
             wait(0.01);
-        } else {
-            Enablex = 1;
-        }
+        } 
 
         if (Ps_y > 10) {
             Diry = 0;
@@ -266,9 +267,7 @@
             hstep_freqy = hnew_step_freqy;
             Stepy.period(1.0/hstep_freqy);
             wait(0.01);
-        } else {
-            Enabley = 1;
-        }
+        } 
 
     }
     lcd.cls();