What are these cables? What are they connected to other than the circuit you are building?
Do you actually mean a cable tester? Simply to check cables that you would otherwise connect to something else?
In general, it is not a good idea to connect something external to the 5V supply line. You connect it to ground, and apply a voltage to the other end, from the 5V line via a 270 ohm resistor and then use a 10k resistor from the test point to an Arduino input to sense the voltage. If it is LOW, then the cable is connected and pulling it to ground, if it is HIGH, then the cable is clearly not connected.
If for some reason you want to switch the "test" on and off, then that 270 ohm resistor can be connected to an Arduino output pin instead of the 5V supply.
Let me check I have this straight in my mind.... you want to read a pin to see if it's been taken to 5V by a wire, the other end of which is in the Arduino 5V?
If I have that correct, then that's really just this example in the IDE at File > Examples > Basics.
Not the presence of the pull down resistor to make sure the pin is low when it's not high.
Thanks guys for your infos.
Basically, I'm building a "physical game" that need, between the other things, to connect some cables (4 on the left side with 4 on the right side) together, in the correct order. Because 2 pair of cables will be there just to "confuse the ideas" (they probably will not be connected to anything), when the 2 right pair of cables will be connected, I need to receive an input to activate the next part of the game.
The example I linked shows you how to read a pin, which is still something you need to do. So get that clear in your mind and working.
Then before you code any further, I'd suggest you think through how you would manually test for the 2 wires being connected in the correct sequence.
You might have to check first, for example, that A is connected and B is not... if so, how will you record that fact, so that when B is connected you know it's successful? Your system needs to be in some kind of "waiting for A" state right at the start, then "waiting for B" when A is connected. But when it's "waiting for A" and B is connected out of sequence, then what.
This is a really good example of what's known as a finite state machine, and you might like to read this link. You'll be more successful if you think this through before you dive into code.
But as I say, make sure you know how to read a switch first, and look at if - else while you're at it.
Yes, I think connecting both ends of the resistor to the same row of pins on a breadboard is a red flag. From this point on, anything can happen...
Does this mean that I can just bring 5V (for example taken from the 5V pin) to an input pin and read there an HIGH state?
Inputs are HIGH IMPEDANCE. They can be directly shorted to 5V or GND without damaging anything.
I'm not sure why you would use the 5V power pin though. Why do you want to make the input HIGH ?
Each input pin requires it's OWN pullup resistor. you can't share them like your wiring diagram. If one of them is an input then that's different but your Fritzing was wrong and you haven't corrected it. The resistor
is shorted to itself. 10 k ohm is the correct value for the pullup. FIX YOUR FRITZING .