EMG original converter code
Dependencies: HIDScope MODSERIAL biquadFilter mbed
Fork of EMG_converter_code by
Diff: main.cpp
- Revision:
- 4:fd29407c3115
- Parent:
- 3:a69f041108d4
- Child:
- 5:46e201518dd3
--- a/main.cpp Mon Oct 26 14:05:37 2015 +0000 +++ b/main.cpp Mon Oct 26 14:22:40 2015 +0000 @@ -22,7 +22,7 @@ double signalpart4; double signalfinal; double onoffsignal; -double maxcal=1; +double maxcal=0; /* */ void filter(){ @@ -47,17 +47,32 @@ int main() { + pc.baud(115200); led1.write(1); led2.write(1); - sample_timer.attach(&filter, 0.002);//continously execute the EMG reader and filter + bool calyes=0; + + if(calyes==1){ + sample_timer.attach(&filter, 0.002);//continously execute the EMG reader and filter + } while(1){ - pc.baud(115200); - pc.printf("%f \n", onoffsignal); - if(onoffsignal==0.02){ + if(button1.read()==false){ + for(int n =0; n<5000;n++){ + double signalmeasure =emg.read(); + pc.printf("%d", signalmeasure); + if (signalmeasure > maxcal){ + signalmeasure = maxcal; + } + calyes=1; + } + } + + // pc.printf("%f \n", onoffsignal); + if(onoffsignal<=0.02){ led1.write(0); led2.write(1); } - else if(onoffsignal == 0.05){ + else if(onoffsignal >= 0.05){ led1.write(1); led2.write(0); }