script zover
Dependencies: HIDScope MODSERIAL mbed
Diff: main.cpp
- Revision:
- 7:5f1c0bcd3f69
- Parent:
- 6:6f0bc2e465b0
- Child:
- 8:37563d2ec529
--- a/main.cpp Mon Oct 20 09:50:55 2014 +0000 +++ b/main.cpp Mon Oct 20 09:54:15 2014 +0000 @@ -49,10 +49,10 @@ return yhp1; } -float lpfilter1(float yhp1) +float lpfilter1(float emg_value) { static float x1=0,y1=0,x2=0, y2=0,x; - x = yhp1; + x = emg_value; ylp1 = A1LP1*x1-B1LP1*y1+A0LP1*x2-B0LP1*y2; x2 = x1; x1 = x; @@ -61,10 +61,10 @@ return ylp1; } -float notchfilter(float ylp1) +float notchfilter(float emg_value) { static float yn,x1=0,x2=0,y1=0,y2=0,x; - x = ylp1; + x = emg_value; yn = A0N*x + A1N*x1+A2N*x2+B1N*y1+B2N*y2; x2 = x1; x1 = x; @@ -100,8 +100,8 @@ looptimerflag = false; emg_value = readEMG(); yhp1 = hpfilter1(emg_value); //function hpfilter - ylp1 = lpfilter1(yhp1); //function filter - yn = notchfilter(ylp1); + ylp1 = lpfilter1(emg_value); //function filter + yn = notchfilter(emg_value); ysum = ysum+yn; n++;