State machine with EMG functions and parameters
Dependencies: biquadFilter FastPWM HIDScope MODSERIAL mbed
Fork of StateMachine by
Diff: main.cpp
- Revision:
- 0:c0c35b95765f
- Child:
- 1:d5ff787228fa
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Oct 31 10:30:41 2018 +0000 @@ -0,0 +1,22 @@ +// ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡ PREPARATION ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡ +// Libraries +#include "mbed.h" +#include "biquadFilter.h" +#include "FastPWM.h" +#include "HIDScope.h" +#include "MODSERIAL.h" + +// Inputs & outputs +DigitalOut redled(LED_RED,1); // red LED K64F +DigitalOut greenled(LED_GREEN,1); // green LED K64F +DigitalOut blueled(LED_BLUE,1); // blue LED K64F +InterruptIn buttonbio1(D0); // button 1 BioRobotics shield +InterruptIn buttonbio2(D1); // button 2 BioRobotics shield +InterruptIn buttonK64F(SW3); // button on K64F +InterruptIn emergencybutton(SW2); // emergency button on K64F + +// Define & initialise state machine +enum states { waiting, calibratingMotors, calibratingEMGx, calibratingEMGy, + homing, operating, flipping, failure, demo }; +states currentState = waiting; // start in waiting mode +bool changeState = true; // initialise the first state \ No newline at end of file