state switch test, works but switches 2 times
Dependencies: EMGFilter HIDScope MODSERIAL biquadFilter mbed
Revision 2:810de22bca6a, committed 2017-10-27
- Comitter:
- vera1
- Date:
- Fri Oct 27 09:10:21 2017 +0000
- Parent:
- 0:f49bda586fc5
- Commit message:
- working version.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r f49bda586fc5 -r 810de22bca6a main.cpp --- a/main.cpp Thu Oct 26 10:09:33 2017 +0000 +++ b/main.cpp Fri Oct 27 09:10:21 2017 +0000 @@ -51,6 +51,8 @@ { if (go_calibration) { emg1.calibration(); // Using the calibration function of the EMG_filter class + emg2.calibration(); + //emg3.calibration(); } } @@ -73,7 +75,9 @@ void r_processStateSwitch() { + while(go_switch) { + go_switch = false; switch(state) { case R_HORIZONTAL: state = R_VERTICAL; @@ -97,8 +101,7 @@ pc.printf("state is horizontal"); break; } - wait(3.0f); - go_switch = false; + wait(1.0f); ledstatedef = 1; ledstateswitch = 0; } @@ -124,7 +127,7 @@ int main() { - pc.baud(115200); // Set baudrate for proper communication + pc.baud(9600); // Set baudrate for proper communication go_EMG = true; // Setting ticker variables go_calibration = true; // Setting the timeout variable calibrationgo.attach(&calibrationGO, 5.0); // Attach calibration timeout to calibration function @@ -140,7 +143,7 @@ go_switch = true; } - + pc.printf("emg1 = %f, emg2 = %f\r\n", emg1.normalized, emg2.normalized); switch(state) { case R_HORIZONTAL: