# Measuring resistance conceptually and in code?

How would I measure resistance over a certain length? In this case the resistance is variable.

What I have in my head is that you would output a certain amount of current from one pin, and measure how much comes back from the other.

I'm not sure if this would work, or how to implement it in code.

I've seen this forum post, but it's not making much sense to me.

How can I measure resistance?

• Read up on voltage dividers. It's 2 resistors in series. Usually the resistor values are known and chosen depending on what output voltage you want given a set input voltage. But, if you have a known/unknown resistor and can measure the output voltage you can determine the value of the unknown resistor. Apr 7, 2014 at 0:48
• @sachleen That is a valid answer. Apr 7, 2014 at 1:58
• 2 points: first, input current = output current (Kirchhoff's current law). Second: you mentioned a "certain length", do you really mean length or duration? If it is length, then an important question is about how long? Are we talking about centimeters, meters, kilometers? Apr 7, 2014 at 4:34
• Do you know what Resistance Value (in Ohms) your resistance is and how accurately you need to know the value? This would help answer the question. For example, measuring 0.01 Ohms would require a different approach than measuring 1000 Ohms; and measuring to 50% accuracy would be very different to 0.1% accuracy. Apr 8, 2014 at 14:29