Hi Guys,
I'm new at this so please try and explain in simple language. Why does the circuit has to go to ground when it's connected to the input pin of the basic stamp? Isn't the basic sending the signal to ground anyway?
Please see the diagram below.
Thanks!
Comments
Welcome to the forum!!
Current will follow the least path of resistance. When the switch is open, the least path of resistance is through the resistor to ground. If the pin is configured as an input, it will read this as a "0". When the switch is closed, the least path of resistance is through the switch. In this case the resistor acts as a current limiter to prevent a direct short to ground. If the pin is configured as an input, it will read this as a "1".
Thank you for the welcome,
From the diagram I would think that when the switch is open no current can flow because the is a break in the circuit. So, when the switch is down then the current can flow. So, if that is the case why would you ever need the resistor?
Or did I read the diagram wrong, do you mean when the switch is down that it is connected to the input pin. When the switch is up it's just connected to earth. If that is the case how can you tell the difference from what I assumed and from what is correct :S
Thanks,
Cameron.
Just because the pin is an input doesn't mean that current doesn't flow through it. In fact it does, so in order for the pin to detect a "0" current must flow from the ground through the resistor and into the pin where the external state can be determined.
So far everybody has basically stated the same thing... if an input pin is 'floating' it's still taking the least path of resistance, however in this configuration it is most sensitive to external electrical noise which can cause the reading to be seemingly random or 'floating' . At some finite point the definition of 'floating' becomes 'fixed' depending on where you define a threshold... by forcing an alternative path of 'least' resistance (a 10k resistor in this case) you create an immunity or attenuation to any external noise that would normally affect the I/O pin. Still when you close the switch the switch provides an even lower path of resistance over-riding the 10k resistor.