Also, to avoid false readings and weird behavior of the switch a pause should always be set after a ground is detected (if a pullup resistor is used). This pause is for debouncing the switch and to let the ringing pass. In an 'ideal' switch you wouldn't need this debouncing pause period, but a real world switch will mechanically oscillate and act strange.
Robert




Bookmarks