Just got an Arduino board and I'm new to this cool stuff. I've been going through tutorials and playing around.
I'm a little confused by the fading example. What is the purpose of the resistor? Doesn't the LED provide the resistance?
I've been running the program without the resistor and it seems to work on digital pin 9 (as the program indicates) but if I switch the digital pin to anything else it doesn't work. If the value is greater than half of 255 then the LED stays on if it is less than half of 255 then it is off.
Please help! I hope I'm not screwing up the board messing around like this...
I hope I'm not screwing up the board messing around like this...
You are. Stop now. The LED is a light emitting diode. It provides no resistance. With no resistor, there is nothing to limit the current. With nothing to limit the current, the current pulled by the LED will exceed the current capabilities that the pin can provide, and damage will occur. May not be noticeable for a while, but damage is occurring.
Not all pins can support PWM. Only those labeled on the board as such. For the others, the result of trying to use them as PWM pins results in the behavior you are seeing.
Thank you so much for the reply Paul. I didn't do it that much but I have been screwing with it for the last few hours. Do you think I damaged something? How would I notice if I damaged something?