Finite State Machine for use with Arduino