The Arduino state change detection is a good tutorial, but it uses an active high switch. The more popular way to wire a switch is to wire it to ground and an input with the internal pullup enabled (active low). Here is my state change detection for active low switches.