I'm just starting to learn Ladder Logic Programming. I'm using Allen Bradley RSLogix 5000.
I've been tasked with developing a 'Simple' Coffee Machine which operates like so:
- Toggle Push Button to Start
- Drop Cup (for 10 seconds)
- Feed Hot Water (for 10 seconds)
- If required, Add Milk (for 10 seconds)
- If required, Add Sugar (for 10 seconds)
- Procedure Complete - Illuminate Complete Light (for 10 seconds)
I have implemented everything except the OPTIONAL add Milk & OPTIONAL add Sugar.
Options are:
- To have a Coffee without either Milk or Sugar.
- Or have a Coffee with Milk and Not Sugar.
- Or have a Coffee with Sugar & Not Milk.
- Or have a Coffee with BOTH Sugar & Milk.
I'm considering using Toggle Buttons to select / jump to a Subroutine (choosing the required ingredient make-up). But I'm wondering if there is another way to sequentially go through the procedure?
Thanks.

Another method would be to give a value to each step (say 1 thru 5) and keep track of the value using an integer. Then when you are in step 4 (f required, Add Sugar (for 10 seconds)) and the option is false you can "jump" this step and go directly to step 5.
pseudocode:
if currentstep == 4 AND AddSugar = true then
Add Sugar for 10 seconds
currentstep = 5
Else
- currentstep = 5