4 directional EMG control of the XY table. Made during my bachelor end assignment.
Dependencies: C12832_lcd HIDScope mbed-dsp mbed
Diff: main.cpp
- Revision:
- 13:c4e80f6e7113
- Parent:
- 11:74ae4e5e11ab
- Child:
- 14:bbef6e8956dc
- Child:
- 15:ae8b209e8493
diff -r 74ae4e5e11ab -r c4e80f6e7113 main.cpp --- a/main.cpp Tue Apr 28 12:28:53 2015 +0000 +++ b/main.cpp Tue Apr 28 14:26:30 2015 +0000 @@ -9,6 +9,7 @@ DigitalOut MS2(p28); DigitalOut MS3(p29); AnalogIn Pot1(p19); +AnalogIn Pot2(p20); C12832_LCD lcd; BusIn Joystick(p12,p13,p14,p15,p16); @@ -21,7 +22,9 @@ MS1 = 1; MS2 = 0; MS3 = 0; - int p1; + float p1; + float p2; + Step.period(1./step_freq); // 1 kHz, vanaf 2,5 kHz doet de motor het niet meer. Step.write(0.5); // Duty cycle van 50% @@ -33,8 +36,8 @@ 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); - wait(0.01); //Hier nog ticker inbouwen + lcd.printf("Pot1 : %f \n", p1); + wait(1); //Hier nog ticker inbouwen } } \ No newline at end of file