Open
Description
When analogWrite() is called to write to a pin that is in digital mode, it maps the analog output value to 8 bits and then applies a threshold of 128, writing LOW if < 128 else HIGH. To me this is plain wrong, as one expects in C and C++ that only a value of 0 will result in LOW.
I suggest the code be changed as follows:
311,316c311
< value = mapResolution(value, _writeResolution, 8);
< if (value < 128) {
< digitalWrite(pin, LOW);
< } else {
< digitalWrite(pin, HIGH);
< }
---
> digitalWrite(pin, value == 0 ? LOW : HIGH);
Metadata
Metadata
Assignees
Labels
No labels