How to write Finite state machine (FSM) for current/voltage sensor?

Top