Skip to content

Don't give special treatment of 0 and 255 in Arduino AVR Boards' analogWrite() #170

Open
@Coding-Badly

Description

@Coding-Badly

http://forum.arduino.cc/index.php?topic=303922.0

By using digitalWrite for analogWrite values of zero and 255 the AVR core creates a situation that can cause a glitch.

The solution is simple. Do not treat zero and 255 as special cases. digitalWrite disables PWM so the user can call digitalWrite in the rare circumstances when they want PWM turned off.

The only side-effect is with Fast PWM pins. Instead of a clean "off" there will be a narrow spike for zero.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions