sample code for Mealy Finite State Machine from my embedded systems class