I'm sorry, I wasn't sure where to post this,
My question is regarding the basics of the GPIO pins present on the arduino.
Specifically I am talking about when the pinmode is set to INPUT.
My understanding is that the digital pins somehow detect the voltage on them, what I do not understand is the basic current flow , and what exactly happens, and how the input pin actually takes input. I believe that a 'input' pin isn't connected either 0V or 5V internally, then where exactly does the current go, and how is the voltage measured?
I read on the website that it has a high impedance, and so very small current flows through it, but where does the current go exactly, and how is the voltage detected?
Is there not a constant current flowing, but only motion of charges till the potential of both pins, the input pin and whatever pin it is connected to (0V/5V), doesn't become same?
Further I was confused regarding pull up resistors and how the voltage will be set in case multiple circuits seem to persist, as in the case when these resistors are used. I have the following doubts:
1)what does "weakly" pull up/down mean? does it mean that the voltage will actually not be 0V or 5V, and somehow only be weakly pulled towards the values(0V / 5V) and thus remain at some intermediate value between the minimum input voltage for HIGH and 5V / maximum input voltage for LOW and 0V. Or, does it imply that the voltage may start 'floating' in case of some high magnitude of interference, in other words, they do pull to 5V/0V, but they can't handle higher amounts of interference/ they'll only work properly with a low magnitude of external interference.
2)why is a resistor used, why not simply connect the input pin with the 0V or 5V pin.
3)If for example, I use the internal pull up resistor, and add a switch which connects the input pin with the GND, then when the switch isn't pressed, the only circuit arrangement present is the pull up one, so, somehow, the voltage at the input pin becomes 5V, now when the switch is kept pressed, there is another path for current available, so now there are two connections at the pin, one going to 5V via a resistor, other going to 0V via the switch, but in all tutorials i found that simply input was taken to be 0. What happened to the 5V pull up resistor now? how come it isn't significant anymore, and the reading simply changes from HIGH to LOW upon keeping the switch pressed?
I think for most of the part, I seriously require a good source/reference for beginners. But still, a detailed explanation would help me more!
Thank you for your time