You may find these resources useful
showing how to use state diagrams; and
with some simple examples of state machines