Hi,
I know this is a noob question, but I am really confused.
is the 10k resistor really necessary for a button connected to an arduino board?
I have connected buttons all my life so far with only 2 pins, Digital and Ground, without the resistor, until I saw that everyone else on google were using 3 pins, Vcc, Gnd, and Digital with a 10k resistor.
You would need to show a picture of the example with 3 pins.
Using 2 pins is fine if one side of the switch goes to ground and the other is connected to an Arduino pin configured for input and with the pins internal pullup resistor enabled 'pinMode(switch,INPUT_PULLUP);' to prevent floating pins triggering randomly. To read the switch the logic is reversed from normal in that the switch pin will normally read HIGH but reads LOW when the button is pressed.
no, an external resistor is not necessary if you want to connect a button between an input and GND - You can connect the button between the input and GND, but then you need to use the internal pullup resistor (just write : pinMode(pin_number, INPUT_PULLUP) ), so that the input is HIGH when the button is released ..... or you can use an external pull-up resistor (between the input and VCC) .
If you don't do any of these, then the input will be in an undefined state when the button is not pressed and your sketch won't work as it should.
Aka, a resistor is necessary for a normal button to work. But this can easily be a internal pull up or down resistor in the micro controller. And normal Arduinos have a build in pull up resistor so that saves you from connecting a resistor externally.
I would suggest that the pushbutton in question had 2 connections to each contact, and that the 'third' connection was actually internally connected to one or other of the two connections you were expecting.
Most people new to electronics tend to think of switches as in the top drawing, where in digital circuits, most things are connected to either Vcc or GND, nothing in between, like the lower drawing.