Script 15-10-2019
Dependencies: Servoaansturing mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 12:93ad9781eeef
- Parent:
- 11:4bc0304978e2
- Child:
- 13:cb40c3037f9c
--- a/main.cpp Mon Oct 14 14:07:30 2019 +0000 +++ b/main.cpp Mon Oct 14 14:44:59 2019 +0000 @@ -48,7 +48,7 @@ // Finite state machine programming (calibration servo motor?) -enum states {Motors_off, Calib_motor}; +enum states {Motors_off, Calib_motor, Calib_EMG, Homing, Operation_mode}; states currentState = Motors_off; bool stateChanged = true; // Make sure the initialization of first state is executed @@ -116,7 +116,7 @@ // (inclusief de end-effector) in de juiste home positie wordt gezet currentState = Operation_mode; stateChanged = true; - pc.printf("Moving to operation mode\n"); + pc.printf("Moving to operation mode \r\n"); } if (Emergency_button_pressed.read() == false) { @@ -127,27 +127,28 @@ case Operation_mode: if (stateChanged) - { + // Hier moet een functie worden aangeroepen die ervoor zorgt dat // aan de hand van EMG-signalen de motoren kunnen worden aangestuurd, // zodat de robotarm kan bewegen if (Power_button_pressed.read() == false) // Normaal waarde 1 bij indrukken, nu nul -> false { - motors_on_off() + motors_on_off(); currentState = Motors_off; stateChanged = true; - pc.printf("Terug naar de state Motors_off"); + pc.printf("Terug naar de state Motors_off\r\n"); } if (Emergency_button_pressed.read() == false) { emergency(); } + // wait(5); else { currentState = Homing; stateChanged = true; - pc.printf("Terug naar de state Homing"); + pc.printf("Terug naar de state Homing\r\n"); } break; @@ -161,7 +162,7 @@ int main(void) { pc.printf("Opstarten\r\n"); - loop_ticker.attach(&ProcessStateMachine, 1.0f); + loop_ticker.attach(&ProcessStateMachine, 5.0f); while(true) { /* do nothing */} } \ No newline at end of file