Strange reaction of PWM outputs

Hello to the community,

I'm just starting to discover the amazing Arduino's world, and every day dig it successfully in several domains.

I am now facing to a strange attitude (...) of the PWM outputs of my brand new Arduino Mega...

Some weeks ago, I remember having successfully dim the lightning of a LED on a PWM pin.

Today, I am unable to light on a LED on pins 8 - 9 or 10 (only these 3 pins are available in my growing project), else than with a 255 value in the analogWrite command.
Every value from 0 to 254 lets the LED off, only 255 lets it on!

The current is limited by a 330 Ohm resistor, after several trials with higher values (until 3.3K).

Could somebody tell me what could happend in that story ?

Thanks in advance

Could somebody tell me what could happend in that story ?

The story is incomplete (hint)

I just finally find where (still not why) the problem is. Adding slashes at the beginning of not concerned lines (digital outputs tests), the problem disappears. I have just to examine these lines.
Thank you.
An idea for how to close this post as solved ?

The analogWrite() code has a test in it to check for 0 and 255, and replaces it with digitalWrite() in those cases. If the timer wasn't running, or was configured differently from how it is on initialization (this is done immediately before setup() is called), you would see this behavior when you tried to get PWM out of the pins it drives.

jackjean:
I just finally find where (still not why) the problem is. Adding slashes at the beginning of not concerned lines (digital outputs tests), the problem disappears. I have just to examine these lines.
Thank you.
An idea for how to close this post as solved ?

The post is not solved (you admit you don't understand the "solution", and the rest of us are still in the dark as to what the problem was in the first place), so to mark it as such is a bad idea.