I use different processes for Heat Strike, Mash and Boil. Each process uses various states.
Heat Strike
1) Heat - Output on PID to strike temperature. Recirculates strike water through RIMS until output of mash tun is at strike temperature
2) Stabilize - Output on PID to strike temperature, recirculates for 10 minutes to stabilize temperature
3) Hold - Output on PID to strike temperature, recirculates until I am ready to dough in, requires Win input to switch to next state
4) Dough In - stops RIMS heat and pump while I dough in and stir mash, requires Win input to switch to next state
5) Continue - starts Mash process and stops Heat Strike process
Mash
1) Mash - Recirculates wort through RIMS while PID holds RIMS temperature at mash temperature for correct time
2) Start mash out - output on PID to mash out temperature with pump on until mash tun output is at mash out temperature
3) Mash Out - holds RIMS temperature to mash out temperature with pump on for mash out time.
4) Valve Change - stops RIMS and pump until I move some valves. Requires Win input to exit state.
5) Sparge - pump on to move sparge water through RIMS to mash tun holding RIMS to sparge temperature, other pump on to move wort to boil kettle. Requires Win input to exit state.
6) End Sparge - Stops first pump to quit adding sparge water and allow remaining wort to drain from mash tun. Requires Win input to exit state.
7) Continue - Starts boil process and exits Mash process.
In all, I have other processes for adjusting the boil PWM, holding the fermentation temperature in the chamber and some for sous vide cooking. Each has multiple states exited by various inputs. Programming is relatively simple as long as you make a flow chart of your process and break it down into discrete steps.