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:
Tue Jun 09 09:46:30 2015 +0000
Parent:
49:056c4de3591e
Child:
51:75a8c7191555
Commit message:
Eindconcept2. 1 motor werkt na een tijdje niet meer.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Jun 09 09:18:25 2015 +0000
+++ b/main.cpp	Tue Jun 09 09:46:30 2015 +0000
@@ -24,15 +24,15 @@
 #define EMG_tresh   0.02
 
 //Motor control
-DigitalOut Dirx(p22);
-DigitalOut Diry(p24);
-PwmOut Stepx(p21);
-PwmOut Stepy(p23);
+DigitalOut Dirx(p21);
+PwmOut Stepx(p22);
+DigitalOut Diry(p23);
+PwmOut Stepy(p24);
 
 //Signal to and from computer
 Serial pc(USBTX, USBRX);
 
-DigitalOut Enablex(p24); //Connected to green led
+DigitalOut Enablex(p26); //Connected to green led
 DigitalOut Enabley(p25); //Connected to blue led 
 
 //Microstepping
@@ -56,7 +56,7 @@
 C12832_LCD lcd;
 
 //Variables for motor control
-float setpoint = 1000; //Frequentie setpint
+float setpoint = 1500; //Frequentie setpint
 float step_freq1 = 1;
 float step_freq2 = 1;
 float step_freq3 = 1;
@@ -251,9 +251,11 @@
     arm_biquad_cascade_df1_init_f32(&highnotch_deltoid, 2 , highnotch_const, highnotch_deltoid_states);
     emgtimer.attach(looper_emg, 0.002);
 
-    Ticker looptimer;
-    looptimer.attach(looper_motorx, 0.01); //X-Spindle motor, why this freq?
-    looptimer.attach(looper_motory, 0.01); //Y-Spindle motor
+    Ticker looptimer1;
+    looptimer1.attach(looper_motorx, 0.01); //X-Spindle motor, why this freq?
+    
+    Ticker looptimer2;
+    looptimer2.attach(looper_motory, 0.01); //Y-Spindle motor
     
     //Microstepping control, now configured as half stepping (MS1=1,MS2=0,MS3=0)
     MS1 = 1;