In my project I need a push button to perform certain actions using Arduino. But unluckily I cannot buy a push button and I am in a bit of a hurry. Can I use the Arduino's 3.3v output pin and input pin to create a switch? I want to add two jumper wires and then connect them together. If both are connected then switch should be on. Can I do this? If yes then how?
Asked
Active
Viewed 158 times
-1
-
I'm voting to close this question as off-topic because hardware questions are off-topic. – gre_gor Sep 07 '17 at 14:06
-
[What topics can I ask about here?](https://stackoverflow.com/help/on-topic) – gre_gor Sep 07 '17 at 15:25
1 Answers
1
You don't need the ouput AND input pins for that, use the VCC, GND and the input pins.
When you connect the digital input pin to VCC, it will register 1. When you connect to GND, it will register 0. If you leave the pin floating, you will get an undetermined result.
If you have a resistor handy (500R, 1K, 10K, does not matter much), you can do something like that:
Arduino GND <---->[resistor]<--+-------> Arduino input pin
|
|
+-= -]--> Arduino VCC
You connect the VCC wire to register true, and disconnect to register false. The resistor in series with GND will avoid the pin being left floating.

ThoriumBR
- 930
- 12
- 25
-
-
No, it will work just fine. You will probably need to add some debouncing on your code, but for a quick test it will work. – ThoriumBR Sep 06 '17 at 20:36