The code in the example is using
analogRead(), which reads the voltage on the
P0 nail and compares it to the 3 volts from the
Here’s a way to think about it: The
3V (they use
P1 at the end) “puts” three volts into the soil. The
P0 measures how much of that 3 volts was “lost” as it travelled through the soil to the
P0 nail. It is doing a comparison (somewhat like subtraction) to see how much it’s changed…it needs both the “start” (
3V) and end (
P0) to do the comparison needed here.
If you haven’t studied voltage and current before, you might take a look at some tutorials. I like SparkFun’s: Voltage, Current, Resistance, and Ohm’s Law, which has a few videos that may help.