I've been looking at different responses why a 10k ohm resistor and I just want to validate it. So the 10k ohm resistor is just there to tell the arduino if the switch is on or off and to make sure any other electric fields mess with pin 2 on the arduino
so basically its saying if the button isn't pressed, nothing should happen, but if it's pressed, it should do something. But if the resistor was connected to 5v, you would have to keep the button down for it to do nothing
could I just connect the button to Gnd via jumper cable?
never mind. It just freaks out
You can connect a switch from the input pin to GND.
In this case you would then turn on the internal pull-up resistor.
In the image in the previous post #3:
pinMode(3, INPUT_PULLUP); // connects a 20-50k resistor between pin 3 an 5 volts.
flyingraccoons2:
so basically its saying if the button isn't pressed, nothing should happen, but if it's pressed, it should do something. But if the resistor was connected to 5v, you would have to keep the button down for it to do nothing
Whether it "does something" is based on how you treat the input logic. In the code, you can decide whether a HIGH or a LOW indicates a button switch press. It's completely arbitrary. There is no law of computing that says that a button switch reading must produce a HIGH when pushed.
larryd:
This tells you everything about: wiring, terminating, and closing a switch.
What program do you use to get this schematic ?
larryd:
If that makes you happy :).
This one will make your eyes water!
“ What program do you use to get this schematic ?”
The program is no longer available.
Many here use ‘Eagle’.