hi all.. i have just gotten the arduino board and starting to learn some stuff.. i have the book entitled "getting started with arduino" and im progressing through it.. One of the first things it shows you is how to switch the LED (13,gnd) on and off with a switch and it uses a 10k resistor between the gnd pin and the active pin (7).. but it doesnt explain why you need a resistor.. Im wondering why cant i just connect 5v, gnd and pin 7 together to enable the switch ? When i tried this it looked like it was shorting out the board as all the LEDs flickered a bit..
If you are shortening +5, pin 7 and ground together you are effectively killing the supply to the board. Shortening +5 to ground forces the +5 to 0volts which may amage your onboard regulator. (Probably won't damage it due to its inbuilt protection but is still a highly unreccomended action).
The resistor from 7 to ground is to stop the point "floating about" and biases towards ground (Lo). When you close the switch to the +5 line you force pin 7 to go "Hi" (as in high, not hello)
There will be a flow of current via the resistor from +5 to ground but this is only 5millamps which is perfectly acceptable.
No questions are dumb - unless you ask the same one more than two times. First one because you don't know and want to learn, second one because you forgot you'd already asked it, and third because , by then, you have proven that you can't be bothered.
thanks.. I noticed when i dont connect pin 7 to anything and i touch it, i get random behaviour on the LED.. is that what you mean by "floating about".. If so, is this because there is a certain amount of charge in the air which gets picked up ? I think i recall hearing something like this in the past..
If you have nothing attached to pin 7 then it is "floating" and susceptible to ANY input signal, from whatever source. Your body develops a static charge simply because parts of you are moving about (rubbing insulators together). The arduino circuit is also "floating" since you presumably have not grounded it to any metallic safety earth. In effect there are potential differences between your body and the arduino circuit. When you touch the input terminal (7) your body voltage excites the arduino input so causing the LED to light, but touching also effectively discharges you with respect to the arduino so the LED goes out. When you next let go, you recharge yourself and the cycle repeats.
thanks jack.. appreciate the help..
For answers to a bunch of these "getting started" questions, see...
tkbyd... ive gone through a few of the tutorials on that page and they are excellent.. thanks for the link.. im finding it really easy to understand the person who wrote those.