My guess is the OP just wants to print when the signal level changes. OP needs to look for a change in the level and not the state of the level.
My guess is the OP just wants to print when the signal level changes. OP needs to look for a change in the level and not the state of the level.