State change detection with analog input?

Thanks Mark
so you mind the preferred option would be to use digital inputs using a low -pass-filter and schmitt trigger.
I never used low- pass-filter ...can you please explain shortly how to connect it?
the schmitt trigger code I'll try to find it searching i nthe forum, but if you also can help me...

Thanks.