I have finally got my program ready, but now I need some help/ideas how to do the following:
I have six states that are launched by different start switches = startSWITCH1 starts stateONE etc...
this is done by "if" so that switch that gives out gnd will the one to go with.
I would like to have one switch that I can toggle thru these 6 states and then one start switch that starts the state I have choosed. Like one push stateONE, two pushes stateTWO etc.
I also need a led for each state, so I can follow which one is selected.
The state change detection example shows how to determine if a switch has become pressed. That is different from determining that a switch is pressed.
When a switch becomes pressed, increment a state variable, and then act on the value of the state variable. That is, automatically advance to the next state. I can't be clearer than that, since you used such lousy names in your post.
Lighting up the LED corresponding to state one should be no different if the stateONE switch was used to trigger the state vs. the stateNEXT switch being used.
I have exactly the same situation. I set up an analog pin with a single pole, double throw toggle switch which is spring-loaded to a center "off" position. The two poles of the switch are tied to ground and 5 v. The analog pin is voltage-divided so that it is at 2.5 volts when the toggle is centered, but receives the gnd or 5 v. level when the toggle is activated. I just read this value each time through the loop, to see if the user is trying to change the state. I'm toggling though about 10 states this way.