pinMode(3, INPUT_PULLUP); // configure pin 3 as input with internal pull-up
if (!digitalRead(3)){ // the ! in front of the read means "not", it will evaluate TRUE if the pin is LOW
// do whatever you want when the button on 3 is pressed
}
by Duane Benson
by Aaron Carman
by Jake Hertz