Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

AnalogWrite creates a PWM when value is 255 #388

Closed
Assignees
Labels
conclusion: resolvedIssue was resolved topic: codeRelated to content of the project itself type: imperfectionPerceived defect in any part of project
@jpcornil-git

Description

On legacy arduino platforms, when analogWrite value is 255, you get a DC/HIGH output (aliased to digitalWrite HIGH), see:

https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/wiring_analog.c#L110

While on UNO R4/renesas platform, 255 is converted to 255/256 and you get a PWM signal, see:
https://github.com/arduino/ArduinoCore-renesas/blob/main/cores/arduino/analog.cpp#L819

To match behavior, value should either be normalized to 255 ((1 << _writeResolution) - 1) or aliased to a digitalWrite as well

Metadata

Metadata

Labels

conclusion: resolvedIssue was resolved topic: codeRelated to content of the project itself type: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /