Coding-Badly / arduino-tiny

Automatically exported from code.google.com/p/arduino-tiny
Other
5 stars 4 forks source link

PWM glitch when ramping up followed by a pause #128

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Summary: when calling analogWrite() with values 0 or 255, it defaults to 
analogWrite() which leaves PWM registers in the previous state, and the next 
analogWrite() starts with a "glitch", very noticeable if "previous" and "next" 
values are far apart.

A simple reproductible test case, with expected output and observed results, is 
available on http://forum.arduino.cc/index.php?topic=303922.0

A simple solution is to get rid of the code that defaults to digitalWrite when 
value == 0 or 255, but probably a cleaner solution would be to make sure that 
registers are not influenced by the previous value upon starting PWM

This is on ATTiny85 using arduino-tiny cores 1.5 (with changed compiler path) 
on Arduino 1.6 IDE

Original issue reported on code.google.com by vicnevicne on 1 Mar 2015 at 10:26

GoogleCodeExporter commented 9 years ago
It defaults to **digitalWrite()**, sorry.

Original comment by vicnevicne on 1 Mar 2015 at 10:28