script zover
Dependencies: HIDScope MODSERIAL mbed
Diff: main.cpp
- Revision:
- 4:92e5c7220897
- Parent:
- 3:9a7ed524bb30
--- a/main.cpp Thu Oct 16 10:55:57 2014 +0000 +++ b/main.cpp Fri Oct 17 08:53:56 2014 +0000 @@ -14,9 +14,8 @@ AnalogIn emg0(PTB1); MODSERIAL pc(USBTX,USBRX); -HIDScope scope(5); +HIDScope scope(4); Ticker timer; -float filter(float); float emg_value, ylp1, yhp1; volatile bool looptimerflag; float ysum = 0, yave=0 ; @@ -28,12 +27,12 @@ return emg0.read_u16(); } -float hpfilter1(float emg0_value) +float hpfilter1(float emg_value) { static float y,x1=0,y1=0,x2=0,y2=0; y = y1*B1HP-y2*B0HP-x1*A1HP+x2*A0HP; x2 = x1; - x1 = emg0_value; + x1 = emg_value; y2 = y1; y1 = y; return yhp1; @@ -80,7 +79,6 @@ if(n==100) { yave = ysum/100; - yave = yave; ysum = 0; n = 0; }