Simple Electrical Game using Arduino UNO - Resistor instead of Button

Hello!

Do you remember that game where you had two wires that you used to connect two images? If you made the correct match an LED lit up, if the match was incorrect nothing would happen.
I am trying to make that with an arduino, where the connection with "an image" is made using banana plugs (direct contact of two wires).

The idea is that the two wires that the gamer uses are connected to 5V and the banana busses (in which the wires will be plugged) are connected to INPUT pins (one per pin). So that if a wire is connected, the 5V is connected to an INPUT pin. However, this cannot be done directly, because that will cause a short. Thus, I need something between the connection of 5V and an INPUT pin, but I am a bit at a loss of how to know/compute what. My guess is a resistor, but with how many Ohms?

Currently I have a button and a 10kOhm resistor between this connection, but the button needs to be replaced such that the two sides can be connected directly using a banana plug.

Summary: I would like a direct connection between 5V and an INPUT pin (by connecting the wires from each pin), but there needs to be something inbetween to keep it safe, but what?

Why don’t you do it the same as for any button input because that is essentially what you are doing. Look at the way to wire buttons which is essentially to use a pin input pull-up and then ground it. So a player will plug a ground into the banana plug that is connected to the pin. This is exactly the same as if he pressed a button. The input is detected and the matching input can then be assessed

larryD of this parish usually posts this:

Okay, so if I understand correctly I can set the pinMode to INPUT_PULLUP, and then I only have to connect ground to the pin and it receives input? (LOW) And this is for the internal pull up

Another option would be to connect the INPUT pin to GND using a 10kOhm resistor. And then I can connect the 5V between the pin and the resistor to receive input? (HIGH on push). This is what I see with my current button setup, am I correct? :innocent:

You can read input high but it is an atypical setup and you need the external components when the typical setup does not. You will have to reverse the logic for any code you copy and paste which uses the more typical low equals pressed. S3 above is typical, S1 is your setup which is what most people intuitively arrive at but eventually give up on in preference to S3

Thank you for your help! This works great :smiley:

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.