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.
Dependencies: Servoaansturing mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 25:582e0b1a9a78
- Parent:
- 24:764b71885785
--- a/main.cpp Tue Oct 29 09:34:25 2019 +0000 +++ b/main.cpp Tue Oct 29 10:19:07 2019 +0000 @@ -176,9 +176,9 @@ filtered_EMG_calf=bqck2.step(filtered_EMG_calf_abs); // De gefilterde EMG-signalen kunnen tevens visueel worden weergegeven in de HIDScope - scope.set(0, filtered_EMG_biceps_right); - scope.set(1, normalized_EMG_biceps_right); - scope.set(2, filtered_EMG_calf); + scope.set(0, normalized_EMG_biceps_right); + scope.set(1, normalized_EMG_biceps_left); + scope.set(2, normalized_EMG_calf); scope.send(); // Tijdens de kalibratie moet vervolgens een maximale spierspanning worden bepaald, die @@ -313,122 +313,51 @@ if (normalized_EMG_biceps_right >= 0.3) { motor1.write(0.3); - motor2.write(0.3); - // motor1_dir.write(1); - // motor2.write(0); - // motor2_dir.write(1); - if (normalized_EMG_calf >= 0.3) - { - motor1.write(0.1); - motor2.write(0.1); - motor1_dir = !motor1_dir; - motor2_dir = !motor2_dir; - motor1.write(0.3); - motor2.write(0.3); - } - if (normalized_EMG_biceps_left >= 0.3) - { - motor1.write(0.8); - motor2.write(0.8); - // motor2_dir.write(1); - // motor1.write(0); - // motor1_dir.write(1); - if (normalized_EMG_calf >= 0.3) - { - motor1.write(0.1); - motor2.write(0.1); - motor1_dir = !motor1_dir; - motor2_dir = !motor2_dir; - motor1.write(0.8); - motor2.write(0.8); - } - } - } + //motor2.write(0.3); + //if (normalized_EMG_calf >= 0.3) + //{ + // motor1.write(0.2); + // motor2.write(0.2); + //motor1_dir = !motor1_dir; + //motor2_dir = !motor2_dir; + // motor1.write(0.3); + // motor2.write(0.3); + //} + } + if (normalized_EMG_biceps_right < 0.3) { motor1.write(0); - motor2.write(0); + //motor2.write(0); if (normalized_EMG_biceps_left >= 0.3) - { - motor1.write(0.8); - motor2.write(0.8); - // motor1.write(0); - // motor1_dir.write(1); - if (normalized_EMG_calf >= 0.3) - { - motor1.write(0.1); - motor2.write(0.1); - motor1_dir = !motor1_dir; - motor2_dir = !motor2_dir; - motor1.write(0.8); - motor2.write(0.8); - } - } - } - if (normalized_EMG_biceps_left >= 0.3) + { + //motor1.write(0.8); + motor2.write(0.8); + //if (normalized_EMG_calf >= 0.3) + //{ + //motor1.write(0.2); + //motor2.write(0.2); + //motor1_dir = !motor1_dir; + //motor2_dir = !motor2_dir; + //motor1.write(0.8); + //motor2.write(0.8); + //} + } + } + + if (Power_button_pressed.read() == false) // Normaal waarde 1 bij indrukken, nu nul -> false { - motor1.write(0.8); - motor2.write(0.8); - // motor1.write(0); - // motor1_dir.write(1); - if (normalized_EMG_calf >= 0.3) - { - motor1.write(0.1); - motor2.write(0.1); - motor1_dir = !motor1_dir; - motor2_dir = !motor2_dir; - motor1.write(0.8); - motor2.write(0.8); - } - if (normalized_EMG_biceps_right >= 0.3) - { - motor1.write(0.3); - motor2.write(0.3); - if (normalized_EMG_calf >= 0.3) - { - motor1.write(0.1); - motor2.write(0.1); - motor1_dir = !motor1_dir; - motor2_dir = !motor2_dir; - motor1.write(0.3); - motor2.write(0.3); - } - } + motors_off(); + currentState = Motors_off; + stateChanged = true; + pc.printf("Terug naar de state Motors_off\r\n"); } - if (normalized_EMG_biceps_left < 0.3) - { - motor1.write(0); - motor2.write(0); - if (normalized_EMG_biceps_right >= 0.3) - { - motor1.write(0.3); - motor2.write(0.3); - // motor2.write(0); - // motor2_dir.write(1); - if (normalized_EMG_calf >= 0.3) - { - motor1.write(0.1); - motor2.write(0.1); - motor1_dir = !motor1_dir; - motor2_dir = !motor2_dir; - motor1.write(0.3); - motor2.write(0.3); - } - } - } + + if (Emergency_button_pressed.read() == false) + { + emergency(); + } } - - if (Power_button_pressed.read() == false) // Normaal waarde 1 bij indrukken, nu nul -> false - { - motors_off(); - currentState = Motors_off; - stateChanged = true; - pc.printf("Terug naar de state Motors_off\r\n"); - } - if (Emergency_button_pressed.read() == false) - { - emergency(); - } // wait(25); // else // {