analogRead

I am trying to make a puzzle where I have 5 terminals on the left, and 5 terminals on the right, and I have 5 wires connecting them, each with a different resistor value.

To solve the puzzle, the correct 2 terminals must be connected with the correct wire. I'm trying to figure out a way to accomplish this and am struggling to do so.

My thought was to use 5 digital pins as the Vin for a voltage divider and then cycle through, turning each on and then off, but my thought processes so far have not worked out (downloading fritzing now to show what I've been attempting). How do I verify both that the correct two pins are connected AND that they are connected by the correct wire?

As an added complication, I'd like the correct solution to have two of the left terminals connect to a single terminal on the right, leaving one terminal disconnected.

More explanation please.

Refer to a schematic, not fritzing.

.

Please, not Fritzing. Those are really hard to see what's going on in. Just draw it on paper and post a picture. Anything is better than Fritzing.

The 5 "jumper cables" are on the left, and the 10 terminals are on the right. Each terminal on the left needs to connect to a specific terminal on the right, using a specific jumper wire.

edit: Photo was too large, and the 5 minute rule is very unhelpful. It'd be nice if they'd let Newbies at least edit posts within the first 5 minutes.

My image keeps failing security checks?

edit: And now the image is not showing up in my post. I know how to use technology, promise. Link to the picture below.

Imgur

Try this thread (Out of Date) Guide: How to Insert Uploaded Images in a Post - Website and Forum - Arduino Forum

It's a common enough issue that someone was nice enough to write up a how to.

I think the security thing is even covered in there, but IIRC if you convert your image to .png you won't have any issues like that.

I'm just dumb. I posted the link to the Imgur page, not the picture itself. If this doesn't work and no picture is visible and I don't respond, assume I've jumped out the window.

You don't really even need the resistors. Connect all the pins on the left to digital pins set as output and driven high. Connect all the pins on the right to digital pins set as inputs with the internal pull-up resistors enabled. Go through the output pins connected to the terminals on the left one at a time pulling them low. Each time you pull one low, go read all the inputs on the right and whichever one is reading low is the one connected to the pin on the left that you just drove to low.

Delta_G:
You don't really even need the resistors.

Trouble is, for the solution to be correct, OR needs to be connected to RR with orange. So the specific jumper used matters. Hence the resistors.

Are you familiar with a voltage divider?

https://learn.sparkfun.com/tutorials/voltage-dividers

OK, that's easy then. Same basic concept but analog inputs instead of digital. Instead of digital inputs on the right you have analog inputs that are connected to the terminals and to 5V through some common value of resistor. Now an unconnected pin will read 1023 as will a pin that is connected to one of the terminals on the left that is still driven high. Just as above, you drive the pins on the left low one at a time. All the analog inputs are going to read 1023 except the one that is connected to that terminal on the left that is driven low. Same as before. Only now, instead of reading low it will read some number that is characteristic of the particular resistor between the two terminals as that resistor and the one connected from the analog input to ground form a divider.

Delta_G:
Instead of digital inputs on the right you have analog inputs that are connected to the terminals and to 5V through some common value of resistor.

So each analog pin is connected to 5V through a common value resistor, but separately from the other analog pins, right? As in, I don't connect each analog pin directly to the others?

And thank you, this is what I couldn't wrap my head around. It didn't occur to me to use the 5V.

If you connected all the analog pins together they'd all read the same voltage and that would completely defeat you. Right?

....yes. That would. Thanks again for your help.

Larry that won't work because that makes all the left side terminals equivalent. As long as you hook the right resistor to the right terminal on the right side then it doesn't matter what terminal it is connected to on the left side.

Right you are.

EDIT:
Look for 3.33V (681) on A0-A4

There are 5 x 5! possibilities - 600 .

It might take a little while to play this game....

Allan

larryd:
Right you are.

EDIT:
Look for 3.33V (681) on A0-A4

I like that one. Avoids the other set of pins completely and leaves you only one number to look for.

I do like that solution, Danny. Though I ended up going with what Delta suggested, since it only required I change one solder connection in order to work.

allanhurst:
There are 5 x 5! possibilities - 600 .

It might take a little while to play this game....

Allan

Ha. Fortunately it's not a matter of simply guessing the correct answer. They are given more to go on. This is a small puzzle in an escape room.