Hello! This is probably very simple stuff to most of you here, but it's got me stumped. I have installed a button on a toy phone installation in which the toy acts like a real phone. The button is sending a signal via pduino: at present when the phone is picked up a 1 is sent and when the phone is placed back on the hook a 0 is sent.
While debugging the patch I have discovered that the button I installed is actually sending a slew of ones and zeros in very quick succession when it is picked up, presumably as it transitions between being fully down and fully up. It typically looks like this if I print it: 1010101. The length is not consistent, although the initial 1 value is always correct.
Replacing the phone produces a more consistent single 0 value, although not always, sometimes it hiccups a 010. Typically though the first digit is the correct 0.
Is there a way to only respond to the first value and ignore the others? The closest equivalent to what I've experienced before is perhaps smoothing analog values when sensors are jittery, but I don't know how to go about doing it with digital 1/0 values. Thanks!