State Machines
in
Programming Questions
•
10 months ago
So I am trying to put together a state machine, and am running into some difficultly.
I created a tab in my sketch called "states.java" with the following lines,
- public enum states { STATE_1, STATE_2, STATE_3, STATE_4, STATE_5, STATE_6, MAX_STATES };
- states state = new states;
Then in my main sketch tab I have the flow like so:
- switch (state){
- case STATE_1 :
- // if this does that, do something
- }
- state = STATE_2;
- break;
- case STATE_2:
- // if this does that, do something
- }
- state = STATE_3;
- break;
- //etc etc
but I am receiving an error saying "cannot find anything named "state". What am I missing?
Cheers!
1