Luckily [Paul Martinsen] has put together a primer of three different ways to use an Arduino to filter signals ... re still working on debouncing a digital input, we have you covered there ...