Debounce the switch contact in arduino with S-R Active Low Latch
The 1M ohm resistor represent the arduino input pin .
The above configration was the old way of connect the arduino with switch. And it generate bounce effect that it make the arduino behave crazy and out of my code.
The bottom configuration is the one that will elminate any contact bounce.