Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HIDScope Servo mbed QEI biquadFilter
Diff: THE.cpp
- Revision:
- 27:399ca1f28bd8
- Parent:
- 26:0b029c8623fe
- Child:
- 28:1481896462ee
--- a/THE.cpp Fri Nov 02 09:48:45 2018 +0000 +++ b/THE.cpp Fri Nov 02 10:00:44 2018 +0000 @@ -177,7 +177,7 @@ volatile double Trans_prev_error = 0.0; // States -enum states {WAIT, MOTOR_CAL, EMG_CAL, START, OPERATING}; // states the robot can be in +enum states {WAIT, MOTOR_CAL, EMG_CAL, START, OPERATING, DEMO}; // states the robot can be in states CurrentState = WAIT; // the CurrentState to start with is the WAIT state bool StateChanged = true; // the state must be changed to go into the next state @@ -911,6 +911,14 @@ break; } + if(button_demo == false) // condition OPERATING --> DEMO; button_demo press + { + CurrentState = DEMO; + pc.printf("\r\nState is DEMO\r\n"); + g = false; + break; + } + wait(delta_t); } @@ -918,6 +926,27 @@ } break; + + case DEMO: + + StateChanged = true; + + if(StateChanged) + { + // execute demo mode + demo_mode(); + + StateChanged = false; + } + + if(button_wait == false) // condition OPERATING --> WAIT; button_wait press + { + CurrentState = WAIT; + pc.printf("\r\nState is WAIT\r\n"); + Statechanged = false; + } + + break; // no default }