![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Code om 4 EMG te filteren, thresholds te zetten met kalibratie en met putty te kijken of die thresholds overschreden worden
Dependencies: MovingAverage mbed biquadFilter MODSERIAL
Diff: main.cpp
- Revision:
- 2:f6060b484caf
- Parent:
- 1:ecd6dc3c839b
- Child:
- 3:9cd46de17b01
--- a/main.cpp Tue Apr 16 11:32:24 2019 +0000 +++ b/main.cpp Tue Apr 16 12:35:11 2019 +0000 @@ -153,7 +153,6 @@ if(emg1_filtered>temp_highest_emg1) { temp_highest_emg1= emg1_filtered; pc.printf("Highest value Duim= %f \r\n", temp_highest_emg1); - } } if(timer_calibration>7 && timer_calibration<10) { @@ -362,29 +361,26 @@ highp2.add( &highp2_1 ).add( &highp2_2 ).add( ¬ch2_1 ); highp3.add( &highp3_1 ).add( &highp3_2 ).add( ¬ch3_1 ); highp4.add( &highp4_1 ).add( &highp4_2 ).add( ¬ch4_1 ); - - // Ticker voor EMG uitlezen - - - temp_highest_emg1 = 0; //highest detected value right Biceps - temp_highest_emg2 = 0; - temp_highest_emg3 = 0; - temp_highest_emg4 = 0; + + temp_highest_emg1 = 0; //highest detected value right Biceps + temp_highest_emg2 = 0; + temp_highest_emg3 = 0; + temp_highest_emg4 = 0; - timer_calibration.reset(); - timer_calibration.start(); - CalibrationEMG(); - pc.printf("threshold1 = %i, threshold1L = %f\r\n", threshold1, threshold1L); - threshold_check_ticker.attach(&threshold_check, 0.01); - led1 = 1; - led2 = 1; - led3 = 1; - sample_timer.attach(&sample, 0.1); - pc.printf("sample timer attached\r\n"); - - timer_calibration.stop(); - - + timer_calibration.reset(); + timer_calibration.start(); + CalibrationEMG(); + pc.printf("threshold1 = %i, threshold1L = %f\r\n", threshold1, threshold1L); + threshold_check_ticker.attach(&threshold_check, 0.01); + led1 = 1; + led2 = 1; + led3 = 1; + sample_timer.attach(&sample, 0.1); + pc.printf("sample timer attached\r\n"); + + timer_calibration.stop(); + + /*empty loop, sample() is executed periodically*/ while(1) {