The forward and reverse problem of the two automatic doors with DC motors and limit switch sensors

You may find these resources useful

showing how to use state diagrams; and

with some simple examples of state machines