const byte PinLed = 10;
const byte PinBut = 3;
// setup is run once at startup
void setup() {
pinMode (PinLed, OUTPUT);
//INPUT_PULLUP enables interval resistor tied HIGH
pinMode (PinBut, INPUT_PULLUP);
}
// loop is run repeatedly
void loop() {
// check if button grounds pin, making it LOW
if (LOW == digitalRead (PinBut))
digitalWrite (PinLed, HIGH); // turn on
// other wise, pin is HIGH
else
digitalWrite (PinLed, LOW); // turn off
}