513
edits
No edit summary |
|||
Line 106: | Line 106: | ||
First of all we need a variable that saves the current state. It represents our State Machines memory. <br> | First of all we need a variable that saves the current state. It represents our State Machines memory. <br> | ||
The most suitable type for such a variable is in this case an | The most suitable type for such a variable is in this case an "[https://en.wikipedia.org/wiki/Enumerated_type enum]".<br> | ||
This enum assigns different names to values: | This enum assigns different names to values: | ||
Line 134: | Line 134: | ||
3) decide the next state | 3) decide the next state | ||
The third part can be done quite comfortably by giving back the new | The third part can be done quite comfortably by giving back the new "state" - value in form of the functions "return" - value into the main loop. | ||
This is an example of how the | This is an example of how the "standby"-state could look like: | ||
[[File:robot_standbyfunc.jpg]] | [[File:robot_standbyfunc.jpg]] |
edits