I've used this in some non-FRC applications:
here's your sensor reading over time:
Code:
00011000000000001111111111111111111100000000
Noise Good input
Your goal is to ignore out the sporadic 1s in the beginning. Try ANDing your sensor input with the previous 2 inputs. This will filter out the noise.
Once you hit the noise:
Code:
(0 AND 0 AND 1) = 0
(0 AND 1 AND 1) = 0
(1 AND 1 AND 0) = 0