how the heck can you connect anything to +5V sometimes *and* Ground sometimes? That doesn't make any sense! If the pin is an input, you have to send electricity to it, so you'd connect it to +5V, right? And if the pin is an output, you connect it to Ground, right?
Forgive my dumb question, but I'm just starting to mess around with Arduinos and building a circuit using them...So based upon my very limited understanding of how an electric circuit works...
your over complicating it (though it can be a complicated subject)inputs can be thought of like a light switch, you turn it off or on, but you are not part of the loop (well you could be but that would be bad), instead of a switch the inputs are connected to transistors, which take very little current to change states (because they are very high impedance)connect a input to +5 and the transistor switches on, connect it to ground and it switches off (it may be backwards I forget how they are arranged in the chip, doesnt really matter for this)Since the transistor takes very little current to reach one state or the other due to its input impedance, if you left it unconnected it would wildly fluctuate as it picks up electrical energy from the air (RF interference, body capacitance whatever ... it actually makes an ok random number) so you need to "steer" (yea I dont like that term either) the pin to one state or another by using a pullup or pull down resistor edit: and no you will find this type of setup on many digital electronics throughout the ages
P.S.QuoteForgive my dumb question, but I'm just starting to mess around with Arduinos and building a circuit using them...So based upon my very limited understanding of how an electric circuit works...This stuff is complicated... As a hobbyst you want to jump into electronics and start doing fun stuff right away, and that's cool. But as a point-of reference, if you were taking Electronic Engineering at a university, you probably wouldn't get around do learning about microcontrollers 'till your 3rd or 4th year! You'd be learning a bunch of basic-boring stuff first. As a hobbyist, you need to learn some of the basics, but you can learn a little at a time as you go-along, and as you need to know it.
that one doesn't connect the pin to +5V or Ground because you're making it part of a conventional circuit, but in order to expose it to a change in electrical potential that will trigger a HIGH or LOW reading... right?
and for the aside about RF interference, etc.