Question regarding analogWrite()

Hi, thanks for taking the time to read my question. I seem to be having an issue with one of the programs I'm working on, specifically with the analogWrite() function. I'm trying to work through one of the example programs where you have a multicolor LED and watch it transition colors through the use of an analofWrite() function. The programing works fine and I can trace the values through a serial monitor so I know the program is doing what it's suppose to do but the output doesn't seem to be correct on the pin. When the write value is below 127 (ex analogWrite(2,127)) it gives me 0V. When it is above 128 I get 5V. I am using a digital pin but it's my understanding that the pin should still oscillate to approximate some value in-between.

I also swear I had the working fine earlier then it suddenly stopped with no changes to the code. Is there a known issues with the HW that might be causing this issue?

Thanks

Jon

That's what happens when you use analogWrite() on a pin that doesn't support PWM output. Check the board description to see what pins support PWM. On the UNO that's pins 3, 5, 6, 9, 10, and 11.

Well, I was unaware of that. Thanks for letting me know.