Wrong input if USB powered.

What is typically done (despite the tutorial) is to use the internal pullup resistor, and use the button push to connect the pin to ground.
No external resistor is needed.

pinMode (pinX, INPUT);
digitalWrite (pinX, HIGH); // enables internal pullup

or in IDE 1.0.1

pinMode (pinX, INPUT_PULLUP);  // enables internal pullup

Then look for a LOW on the pin to base your action on.