Laurence B
/
State_machine
test
Fork of State_machine by
Diff: main.cpp
- Revision:
- 0:65476dd9173d
- Child:
- 1:fc6a544d77d9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 22 14:36:33 2018 +0000 @@ -0,0 +1,59 @@ +#include "mbed.h" +ticker update; +InterruptIn DemoButton(button...); +InterruptIn EMGCalibrationButton(Button...); +InterruptIn MotorCalibration(Button...); + +// Inputs +AnalogIn EMGIn1Biceps(...); +AnalogIn EMGIn1Triceps(...); +AnalogIn EMGIn2Bicepcs(...); +AnalogIn EMGIn2Triceps(...); + + +//Define variables +float xPosition; +float yPosition; +float + + + + + +float TickerFrequency = 1000.0; +enum states {MotorCalibration, EMGCalibration, DemoMode, OperationMode, FailureMode, Reset}; +states state = +// button 1; +// button 2; + + +// function: DetermineState +// Switch statement: in each state functions are executed corresponding to the state +// don't forget the breaks +void DetermineState(){ + switch (state) + { + case MotorCalibration: + // Execute some functions + break; + case EMGCalibration: + break; + case DemoMode: + break; + case OperationMode: + break; + case FailureMode: + break; + case Reset: + break; + default: + } + +int main() +{ + // Execute 'Wait' + update.attach(DetermineState, 1.0/ TickerFrequency); + //include interrupt for switching the states with a button + while (true){ +} +} \ No newline at end of file