When the spa is on on my pool it generates a PWM signal on a 5v LED, but it's not a super stable PWM. All I want to do is be able to sense whether the spa is on or off. If I use digitalRead is sometimes reads as LOW and sometimes reads as HIGH (I assume based on which part of the PWM I happen to be polling). I experimented it pulseIn, but I couldn't get any good results, so I'm not sure I'm doing it right, I also didn't know how to deal with pulseIn when there is no signal at all when the spa is not on.
Is there an easy thing that I'm missing here?