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

Commit 38bbdb5

Browse files
Merge pull request #483 from leonardocavagnis/fix_analogwrite_dc
AnalogWrite: fix DC calculation
2 parents cbeb20d + ed86edd commit 38bbdb5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎cores/arduino/analog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ void analogWrite(pin_size_t pinNumber, int value)
814814
}
815815

816816
if(ptr != nullptr) {
817-
ptr->pulse_perc((float)value * 100.0 / (1 << _writeResolution));
817+
ptr->pulse_perc((float)value * 100.0 / ((1 << _writeResolution) - 1));
818818
}
819819
}
820820

0 commit comments

Comments
(0)

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