Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: PID_VelocityExample TheProgram Passief_stuurprogramma Actief_stuurprogramma
Diff: EMG.h
- Revision:
- 6:49056e5ea42e
- Parent:
- 5:7873900f62da
- Child:
- 7:8ce86cc65126
diff -r 7873900f62da -r 49056e5ea42e EMG.h --- a/EMG.h Wed Oct 14 11:29:52 2015 +0000 +++ b/EMG.h Wed Oct 14 13:16:07 2015 +0000 @@ -46,6 +46,13 @@ y1 = highpass1.step(u1); y2 = highpass2.step(u2); y3 = highpass3.step(u3); y4 = highpass4.step(u4); // filter order is: high-pass --> rectify --> low-pass y1 = fabs(y1); y2 = fabs(y2); y3 = fabs(y3); y4 = fabs(y4); y1 = lowpass1.step(y1)*cali_fact1; y2 = lowpass2.step(y2)*cali_fact2; y3 = lowpass3.step(y3)*cali_fact1; y4 = lowpass4.step(y4)*cali_fact1; // roughly normalize to a scale of 0 - 1, where 0 is minimum and 1 is roughly the maximum output of dennis. + + + + + + + } @@ -61,6 +68,7 @@ void calibrate() // function to calibrate the emg signals from the user. It takes 5 seconds of measurements of maximum output, then takes the max and normalizes to that. { + outofboundsled=0; cali_fact1 = 1; cali_fact2 = 1; double cali_max1 = 0; double cali_max2 = 0; for(int i = 0; i < 5*Fs; i++) @@ -74,11 +82,12 @@ { cali_max2 = y2; } - wait(1/Fs); + wait(1/(float)Fs); } cali_fact1 = 1.0/cali_max1; cali_fact2 = 1.0/cali_max2; calibrate_go = 0; + outofboundsled=1; } /*