Noise on a Switch

actually the easiest way to solve this is to use a digital pin, rather than analog. the digital pins are high and low anyway, so with just a delay function, it will correctly read only on or off!