Consider what each conveyor should do in each mode.
I would save the mode in an integer variable like this:
Depending on the mode each conveyor will behave differently.
For example:
If you don't have a clear idea how it's going to work, don't write any program code. Spend time thinking about it more instead. Use paper or a whiteboard or whatever. Visual is better than text.
I would save the mode in an integer variable like this:
- Idle/empty = 0
- Buffering = 1
- Buffering Full = 2
- Transport to sink = 3
Depending on the mode each conveyor will behave differently.
For example:
- Conveyor 2 will only run when you are in mode 3 (transport to sink). After conveyor 2 have sent 5 packages + some extra time to clear the conveyor the mode should change to mode 0 (idle/empty).
- Conveyor 0 will only run when you are in mode 1 (buffering).
- Buffer conveyor will only run when you are in mode 1(buffering) or in mode 3 (transport to sink).
- Etc.
If you don't have a clear idea how it's going to work, don't write any program code. Spend time thinking about it more instead. Use paper or a whiteboard or whatever. Visual is better than text.






