Hi all, I have a simple circuit with two 10k resistors each connected to an LED and to pins 11 or 12. I need the voltage across the resistors to be very precise but when I measure it, I get different results depending on what I write in the setup function. The code is a basic blink code.
It works fine except for the following, if I define the pinMode for pin 11 (note it is not used in the loop code) the voltage across the resistor connected to pin 12 is 1.8V when HIGH , but if I do not define pinMode for pin 11 (or just comment the line) then I get 2,2V. Question is, why defining a pin or not would change the behavior of another pin (even if the defined pin is not used within the loop()?). In case it makes a difference, the resistors are in fact electrodes placed in a fish tank.
I think you need to share a schematic with us. Is not clear to me how everything is wired. But my guess would be that the state of one pin is affecting the reading on the other pin because both electrodes are in the same water and that is providing a current path between them.
Thanks for your reply PaulRB! Both of the electrodes are in the same tank and there is a shared current path, however that path remains always the same, the only thing I change is whether I define pinMode for pin11 or not. I´ll give a brief description since I suck at schematics, the tank is rectangular, divided in two by a glass wall with a small hole in it. The electrode connected to pin 11 is on one side of the wall and the one connected to 12 is on the other side. In front of each electrode (separated by water) there is a ¨ground¨ electrode connected to an LED which is connected to ground. There is a leak through the hole in the dividing glass but anyway it should be constant independently of how I setup the pins? Maybe I´m missing something about what the board does when the pinMode is set?
Thanks!