PWM glitch (ATTiny)

Vicne:
Oh, and by the way, I tested the symmetric situation...

Excellent. Thank you.

I guess it makes sense according to your analysis.

Yes, it does.

I find it really strange that nobody noticed that before however... :slight_smile:

Well, a few possibilities come to mind...

• Timing. Notice the code I posted includes some while conditions. They are used to synchronize the rest of the code to timer 1. Without those the problem is less severe / less likely to occur.

• LED quality. The burst is so short some LEDs may not produce visible light.

• Inertia. When driving a motor (any "large" load) the short burst is unlikely to have an effect.

Issue added... Don't give special treatment of 0 and 255 in Arduino AVR Boards' analogWrite() · Issue #170 · arduino/ArduinoCore-avr · GitHub

Hi,

@Coding: Just wanted to thank you very much for your prompt and effective replies :slight_smile:
I now have the explanation, a short term solution, and the impression I brought something to the community :wink:

Kind regards,

Vicne

1 Like