if (motorspeedA >= stirspeed){ //?? reached desired speed?
// next step
// Rest of your program
//
}
else {
motorspeedA++;
analogWrite(44, motorspeedA);
delay(stir_ramp);
}
I can wrap my head around this.
As far as I can see, you're using the global counter variable as a sub-state which controls actions within the current state. It's not the most elegant FSM design I've ever seen but it seems viable, and with that scheme in place it seems appropriate to use that to handle startup processing for this state. I don't see that this is any less elegant than the one-off display output.
LOL. I am sure it is not the most elegant ever it is the only one I have ever written and example code was hard to come by. I really did not like what I came up with for the display but it worked so I moved on.
Just out of curiosity, are any of the other states similar to this one? I noticed that several identifiers associated with this state contain a number, which always makes me suspicious.
Yes there is 3 of every thing (fill, stir and drain). Suspicious of what?
The mixed use of of blocking and non-blocking code, widespread use of global data (which now requires duplicate handling for each state) and sheer number of states would make me want to rationalise the state machine.
Post
And, you lost me. I will look into rationalising.
This is the Prototype and there is another version coming so I am really trying to wrap this up for the beta testers. So right now function is more important than style.