Start of the coding
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 00003 wat nou als ik hier wat typ 00004 00005 00006 HOelang is een chinees 00007 en Wie is zijn zusje 00008 00009 ticker update; 00010 InterruptIn DemoButton(button...); 00011 InterruptIn EMGCalibrationButton(Button...); 00012 InterruptIn MotorCalibration(Button...); 00013 00014 // Inputs 00015 AnalogIn EMGIn1Biceps(...); 00016 AnalogIn EMGIn1Triceps(...); 00017 AnalogIn EMGIn2Bicepcs(...); 00018 AnalogIn EMGIn2Triceps(...); 00019 00020 00021 //Define variables 00022 float xPosition; 00023 float yPosition; 00024 float 00025 00026 00027 00028 00029 00030 float TickerFrequency = 1000.0; 00031 enum states {MotorCalibration, EMGCalibration, DemoMode, OperationMode, FailureMode, Reset}; 00032 states state = 00033 // button 1; 00034 // button 2; 00035 00036 00037 // function: DetermineState 00038 // Switch statement: in each state functions are executed corresponding to the state 00039 // don't forget the breaks 00040 void DetermineState(){ 00041 switch (state) 00042 { 00043 case MotorCalibration: 00044 // Execute some functions 00045 break; 00046 case EMGCalibration: 00047 break; 00048 case DemoMode: 00049 break; 00050 case OperationMode: 00051 break; 00052 case FailureMode: 00053 break; 00054 case Reset: 00055 break; 00056 default: 00057 } 00058 00059 int main() 00060 { 00061 // Execute 'Wait' 00062 update.attach(DetermineState, 1.0/ TickerFrequency); 00063 //include interrupt for switching the states with a button 00064 while (true){ 00065 } 00066 }
Generated on Sun Aug 21 2022 00:34:22 by
1.7.2