I'm a super beginner with all things electronics and am working my way through the projects book. On the circuit for the 2nd project, why do we have to connect the pin to ground when the switch isn't open? If we're testing for LOW (e.g. 0 volts), wouldn't it be ok to just not connect it to anything? Also, why is a 10k-ohm resistor used? (I could test it without connecting it to anything, but I'm so new to electronics I want to make sure I get the basics down so I don't break anything).
Hello cbriz,
welcome.
It's best to assume that none of us is familiar with the project book you have, so you need to be explicit about what you are looking at.
On the circuit for the 2nd project, why do we have to connect the pin to ground when the switch isn't open? If we're testing for LOW (e.g. 0 volts), wouldn't it be ok to just not connect it to anything?
Common mistake of people new to electronics. Not connected to anything is NOT the same as connected to 0V. An input that is not connected is said to be 'floating', which means it has some voltage on it (everything in the Universe made of ordinary matter has a voltage on it) but that voltage is not defined by anything, so could be any old voltage*. If you want it to be a definite voltage you have to connect it to something.
*It will be somewhere between about 0.6V below 0V and 0.6V above Vcc. What it actually is depends on what the pin picks up from the environment.
PerryBebbington:
Hello cbriz,
welcome.It's best to assume that none of us is familiar with the project book you have, so you need to be explicit about what you are looking at.
Common mistake of people new to electronics. Not connected to anything is NOT the same as connected to 0V. An input that is not connected is said to be 'floating', which means it has some voltage on it (everything in the Universe made of ordinary matter has a voltage on it) but that voltage is not defined by anything, so could be any old voltage*. If you want it to be a definite voltage you have to connect it to something.
*It will be somewhere between about 0.6V below 0V and 0.6V above Vcc. What it actually is depends on what the pin picks up from the environment.
Awesome thank you! This makes total sense. I'll keep in mind what you said about the project book going forward.