4 directional EMG control of the XY table. Made during my bachelor end assignment.
Dependencies: C12832_lcd HIDScope mbed-dsp mbed
Revision 35:b0737ee24b43, committed 2015-05-27
- Comitter:
- jessekaiser
- Date:
- Wed May 27 14:20:06 2015 +0000
- Parent:
- 34:025b324d15d6
- Child:
- 36:d6e0a835bb2d
- Commit message:
- Jeej, het werkt weer! Proportionele besturing en LCD werkt;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed May 27 12:29:19 2015 +0000 +++ b/main.cpp Wed May 27 14:20:06 2015 +0000 @@ -28,7 +28,7 @@ AnalogIn Pot1(p19); AnalogIn Pot2(p20); AnalogIn emg0(p17); -HIDScope scope(2); +HIDScope scope(1); Ticker scopeTimer; //lcd @@ -43,7 +43,7 @@ //lowpass filter settings biceps: Fc = 2 Hz, Fs = 500 Hz, Gain = -3 dB float lowpass_const[] = {0.00015514839749793376, 0.00031029679499586753, 0.00015514839749793376, 1.9644602512795832, -0.9650808448695751}; arm_biquad_casd_df1_inst_f32 highnotch_biceps; -//highpass filter settings: Fc = 20 Hz, Fs = 500 Hz, notch Fc = 50, Fs =500Hz +//highpass filter settings: Fc = 20 Hz, Fs = 500 Hz, notch Fc = 50, Fs = 500 Hz float highnotch_const[] = {0.8370879899975344, -1.6741759799950688, 0.8370879899975344, 1.6474576182593796, -0.7008943417307579, 0.7063988100714527, -1.1429772843080923, 0.7063988100714527, 1.1429772843080923, -0.41279762014290533}; //state values @@ -77,7 +77,7 @@ /*send value to PC. */ - scope.set(0,filtered_biceps); //Filtered EMG signal + scope.set(0,emg0.read()); //Filtered EMG signal } void looper_motor() @@ -101,7 +101,7 @@ int main() { - // Attach the HIDScope::send method from the scope object to the timer at 50Hz. Hier wordt de sample freq aangegeven. + // 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); Ticker emgtimer; @@ -121,6 +121,7 @@ while (1) { lcd.printf("Freq %.0f Hz \n", step_freq); //snelheid meting op lcd + //pc.printf("%.3f \n", emg0.read()); wait(0.01); } }