INPUT_PULLUP. Connect pin to 5V or Gnd?

I am using a N/O button in my project and I have it set to Pin 8. In the code I have INPUT_PULLUP. Should I be connecting the button to Ground or to +5V?

Ground. When you press the button it will pull the pin LOW. When the button is not pressed the internal pullup resistor will pull it HIGH.

FYI
2017-08-05_20-33-24.jpg

.

search this site foe the ABC by pighixxx (I think that's the right name).

Mark

Ground. Which is to say - the OTHER lead on the button goes to ground.

It might seem a little odd that “low” becomes “on”, but it means that you can connect the other side of the button to the chassis of your build, and you only need the one wire going from the button to the arduino. If it was the other way around, there’s have to be a wire carrying 5v snaking in and out to reach every button.

PaulMurrayCbr:
Ground. Which is to say - the OTHER lead on the button goes to ground.

It might seem a little odd that "low" becomes "on", but it means that you can connect the other side of the button to the chassis of your build, and you only need the one wire going from the button to the arduino. If it was the other way around, there's have to be a wire carrying 5v snaking in and out to reach every button.

My limit switches are also connected w/ INPUT_PULLUP. Is there any way the limit switches could malfunction if I'm grounding to the aluminum body of my project instead of grounding to a grounded pin of the arduino? My project is a motorized TV mount btw.

mjosbesh:
My limit switches are also connected w/ INPUT_PULLUP. Is there any way the limit switches could malfunction if I'm grounding to the aluminum body of my project instead of grounding to a grounded pin of the arduino? My project is a motorized TV mount btw.

The arduino ground needs to be connected to the aluminium body to make the circuit. It's just how electricity works.