When trying to make some simple circuit I've noticed that when I expect my LED to be on - it's off and when I expect it to be off - it's on. At first I thought it's my mistake in thecode or that I didn t understand something correctly. But all sources of information say that analogWrite(0) means always off and analogWrite(255) means always on. Is there something wrong ith my board (Arduino Duemilanove)? Or is it normal with that board?
analogWrite(0) means the pin is always outputting low (ground). If you have the LED connected between the pin and ground, this will be off. If you have the LED connected between the pin and Vcc, this will be on, because a LOW pin state will turn the LED on (the latter wiring method is more common, since chips are usually better at sinking current than sourcing it)
Thank you, you are right. I acciedentally connected it to Vcc instead of Gnd. I didn't know that it can sink current when pinMode is OUTPUT.