# Why does the position of the resistor matter here? (Arduino)

I made a small circuit that when someone push a button a servo rotates to 90° and go back to his initial position after a certain amount of time.

My issue was with the resistor. I needed it to be in a particular position for my small project to work, which confuses me because in the small inner circuit (ground → resistor → input pin → button → source) I thought it was a good idea to get rid of what seem at first a useless cable, so I removed the cable that connects the button to the source and placed the resistor. I connected the input pin directly to the button, but it did not work as I expected.

To make things clearer, I made a picture of the circuit in a different shape.

I learned that in a circuit the position of the resistor has no impact (Ohm's law).

Why is it like this?

PS: The picture of my Arduino breadboard.

• Your first circuit, marked "works", cannot work as drawn, as the input pin is connected directly to battery negative. Commented May 25, 2021 at 1:10
• your circuits are unclear ... there is no GND indicated (the place where you attach the negative probe of your voltmeter) ... that means that only you know how you are performing voltage measurements Commented May 25, 2021 at 1:16
• Yep sorry, I don't know for now how to correctly represent a circuit, it was meant for a "high level" clarification of my intent. Here the position of the resistor compared to an input pin and a switch. Commented May 25, 2021 at 2:00
• Arduino input pins usually have built-in pull up resistors, so the only thing you need is a switch between the input pin and GND. arduino.cc/en/Tutorial/DigitalInputPullup Commented May 25, 2021 at 9:52
• All of those diagrams have the input pin connected to one end of the battery, which should give the pin a constant voltage, regardless of the switch. But in the photo, it looks like you have the input pin connected between the resistor and the switch, which would be the right place. Commented May 25, 2021 at 15:15