Problems to stop a running cycle

This tutorial demonstrates as state machine such as @GrandPete suggests and includes the ability to alter the progression by way of outside influence.