State machine with EMG functions and parameters
Dependencies: biquadFilter FastPWM HIDScope MODSERIAL mbed
Fork of StateMachine by
Diff: main.cpp
- Revision:
- 2:d70795e4e0bf
- Parent:
- 1:d5ff787228fa
- Child:
- 3:9c63fc5f157e
--- a/main.cpp Wed Oct 31 10:32:29 2018 +0000 +++ b/main.cpp Wed Oct 31 11:21:16 2018 +0000 @@ -1,7 +1,7 @@ // ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡ PREPARATION ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡ // Libraries #include "mbed.h" -#include "biquadFilter.h" +#include "BiQuad.h" #include "FastPWM.h" #include "HIDScope.h" #include "MODSERIAL.h" @@ -15,16 +15,25 @@ InterruptIn buttonK64F(SW3); // button on K64F InterruptIn emergencybutton(SW2); // emergency button on K64F -// PC-communication -bool externalPC = true; // toggle communication with external PC - -if externalPC - { - MODSERIAL pc(USBTX, USBRX); - } - // Define & initialise state machine enum states { waiting, calibratingMotors, calibratingEMGx, calibratingEMGy, - homing, operating, flipping, failure, demo }; + 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 +bool changeState = true; // initialise the first state + +// ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡ STATE MACHINE ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡ + +// ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡ MAIN LOOP ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡ + +int main() { +// ============================== PC-COMMUNICATION ============================= + bool externalPC = true; + if (externalPC) { + MODSERIAL pc(USBTX, USBRX); // communication with pc + } +// ==================================== LOOP =================================== + while (true) { // loop forever + + } +}