State machine
Dependencies: mbed Adafruit_GFX BioroboticsMotorControl MODSERIAL BioroboticsEMGFilter
Diff: main.cpp
- Revision:
- 6:bfc6e68774f5
- Parent:
- 5:2632dfc8454c
- Child:
- 7:e7f808875bc4
diff -r 2632dfc8454c -r bfc6e68774f5 main.cpp --- a/main.cpp Tue Oct 30 11:56:48 2018 +0000 +++ b/main.cpp Tue Oct 30 12:19:51 2018 +0000 @@ -38,7 +38,12 @@ // State just changed to this one. led_green = 1; + screen.clear_display(); screen.display_state_name("Waiting"); + screen.get_screen_handle()->printf(" Press to start "); + screen.get_screen_handle()->printf(" | "); + screen.get_screen_handle()->printf(" V "); + screen.display(); } if (ud_button.is_pressed()) { @@ -53,6 +58,7 @@ // State just changed to this one. led_green = 0; + screen.clear_display(); screen.display_state_name("Motor calibration"); } } @@ -62,6 +68,7 @@ if(last_state != current_state) { last_state = current_state; // State just changed to this one. + screen.clear_display(); screen.display_state_name("EMG 1 calibration"); } } @@ -71,6 +78,7 @@ if(last_state != current_state) { last_state = current_state; // State just changed to this one. + screen.clear_display(); screen.display_state_name("EMG 2 calibration"); } } @@ -80,6 +88,7 @@ if(last_state != current_state) { last_state = current_state; // State just changed to this one. + screen.clear_display(); screen.display_state_name("Homing"); } } @@ -89,6 +98,7 @@ if(last_state != current_state) { last_state = current_state; // State just changed to this one. + screen.clear_display(); screen.display_state_name("Normal operation"); } } @@ -101,6 +111,7 @@ // Update the display. led_red = 0; led_green = 1; + screen.clear_display(); screen.display_state_name("Error!"); }