![](/media/cache/group/9e3cc099b3b04bca937a1cca1da81b19.jpg.50x50_q85.jpg)
Dit is alleen het EMG gedeelte
Dependencies: mbed HIDScope biquadFilter MODSERIAL FXOS8700Q
Diff: main.cpp
- Revision:
- 16:7acbcc4aa35c
- Parent:
- 15:421d3d9c563b
- Child:
- 17:e4e7b1fbb263
diff -r 421d3d9c563b -r 7acbcc4aa35c main.cpp --- a/main.cpp Tue Oct 22 09:07:29 2019 +0000 +++ b/main.cpp Tue Oct 22 10:25:22 2019 +0000 @@ -28,6 +28,10 @@ InterruptIn button2(D10); InterruptIn button3(SW3); +// EMG Substates +enum EMG_States = { emg_wait, emg_cal_MVC, emg_cal_rest, emg_scale, emg_operation }; // Define EMG substates +EMG_States emg_curr_state; // Initialize EMG substate variable + // Global variables for EMG reading AnalogIn emg1_in (A1); // Right biceps, x axis AnalogIn emg2_in (A2); // Left biceps, y axis @@ -215,6 +219,7 @@ led_b = 1; // Turn off calibration led } +// Run calibration in rest void calibrationRest() { timeoutCalibrationRest.attach( &calibrationRestFinished, Tcal); // Stop rest calibration after interval @@ -232,6 +237,12 @@ pc.printf("Factor: %f TH: %f\r\n", factor1, emg1_th); } +/* +------ EMG SUBSTATE MACHINE ------ +*/ + + + void main() { pc.baud(115200); // MODSERIAL rate