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: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 31:465a6e1e1db6
- Parent:
- 30:a16519224d58
- Child:
- 32:7355524d862f
--- a/main.cpp Wed Oct 30 14:43:34 2019 +0000
+++ b/main.cpp Wed Oct 30 16:04:43 2019 +0000
@@ -30,6 +30,8 @@
// variables
+int m = 0;
+
const float pi = 3.1416;
const float l = 0.535;
Ticker TickerStateMachine;
@@ -556,26 +558,28 @@
CurrentState = horizontal_movement;
StateChanged = true;
}*/
-
- while (beweging =='s') {
+ m++;
+ if (m<5) {
EMGy_velocity = -0.02f;
- pc.printf("beweging %c \n\r", beweging);
pc.printf("beweging %f \n\r", EMGy_velocity);
-
+
}
- while (beweging == 'w') {
+ else if (m>=5 && m<=10) {
EMGy_velocity = 0.02f;
- pc.printf("beweging %c \n\r", beweging);
pc.printf("beweging %f \n\r", EMGy_velocity);
}
- while(beweging != 's' || beweging !='w'){
+
+ else {
EMGy_velocity = 0.0f;
+ pc.printf("beweging %f \n\r", EMGy_velocity);
}
- if ((pressed_1) || (pressed_2) /*|| (emg_switch(treshold_leg,EmgCalibration(emgFiltered_leg, mvc_value_leg, rest_value_leg)))*/) { // EMG gebaseerde threshold aanmaken
+
+ /*if ((pressed_1) || (pressed_2) || (emg_switch(treshold_leg,EmgCalibration(emgFiltered_leg, mvc_value_leg, rest_value_leg)))) { // EMG gebaseerde threshold aanmaken
CurrentState = horizontal_movement;
StateChanged = true;
+ }*/
}
-}
+
void while_horizontal_movement()
{
@@ -595,9 +599,11 @@
StateChanged = true;
}
*/
+
if (beweging == 'a') {
EMGx_velocity = -0.02f;
pc.printf(" you pressed %c \n\r" , beweging);
+
}
if (beweging == 'd') {
EMGx_velocity = 0.02f;
@@ -606,6 +612,7 @@
else {
EMGx_velocity = 0.0f;
}
+
if ((pressed_1) || (pressed_2) /*|| (emg_switch(treshold_leg,EmgCalibration(emgFiltered_leg, mvc_value_leg, rest_value_leg)))*/) { // EMG gebaseerde threshold aanmaken
CurrentState = vertical_movement;
StateChanged = true;