I made the PopMech demo robot a few weeks ago and have been upgrading it ever since.
I've added several LEDs to it. Here's my issue:
I have an IR receiver on digital pin 5. I have the LED in question on digital pin 11.
I want to fade/dim the LED on digital pin 11, sort of like a heartbeat. I used seperate sample code from the "Learning" area to test out my setup. It worked fine.
When I integrated that code into my main project code, instead of getting a nice fade/dim, I was getting only a blink.
After commenting out line after line, I found the one line that makes a difference:
If I comment out this line, my fade/dim works perfectly. Otherwise, it doesn't. Also, it would appear that this line, which again refers to an IR Receiver on pin 5, ends up turning my pin 11 into an all or nothing pin -- that is, I can analogWrite(11, 255) and turn the light on pin 11 ON, but any other value (i.e. 50) and the LED is off. If I comment that irrecv line out, my analogWrite works perfectly for any level.
Is this a limitation of the PWM capabilities of the Arduino? Can I really not use the IR receiver and have a fading/dimming LED? Is it just my PIN choices? Do the analog pins provide another way to achieve my goals?