De hele robot in 1 keer bam
Dependencies: mbed QEI Servo HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 5:3d65f89e3755
- Parent:
- 4:09a01d2db8f7
- Child:
- 6:5437cc97e1e6
diff -r 09a01d2db8f7 -r 3d65f89e3755 main.cpp --- a/main.cpp Sun Oct 20 19:25:11 2019 +0000 +++ b/main.cpp Sun Oct 20 19:40:57 2019 +0000 @@ -71,9 +71,18 @@ // Output raw EMG input scope.set(0, emg1 ); + + // Filter notch and highpass + double emg1_n_hp = bqc_notch_high.step( emg1 ); + + // Rectify + double emg1_rectify = fabs( emg1_n_hp ); + + // Filter lowpass (completes envelope) + double emg1_env = bqc_low.step( emg1_rectify ); // Output EMG after filters - scope.set(1, emg1 ); + scope.set(1, emg1_env ); scope.send(); } @@ -99,14 +108,16 @@ low3 = L3.step(absolute3); */ -int main() +void main() { const double Ts = 1/Fs; tickSample.attach(&sample, Ts); + + bqc_notch_high.add( &bq_notch ).add( &bq_H1 ).add( &bq_H2 ); + bqc_low.add( &bq_L1 ).add( &bq_L2 ); while(true) { led = !led; wait(0.5); } - return 0; } \ No newline at end of file