Laurence B
/
State_machine
test
Fork of State_machine by
main.cpp
- Committer:
- laurencebr
- Date:
- 2018-10-22
- Revision:
- 1:fc6a544d77d9
- Parent:
- 0:65476dd9173d
File content as of revision 1:fc6a544d77d9:
#include "mbed.h" wat nou als ik hier wat typ 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){ } }