Skip to content

Commit 1ec6a9d

Browse files
authored
fix(matter): digitalMode necessary before digitalWrite(LOW)
1 parent 05402c4 commit 1ec6a9d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: libraries/Matter/examples/MatterFan/MatterFan.ino

+5-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ void fanDCMotorDrive(bool fanState, uint8_t speedPercent) {
4949
// drive the Fan DC motor
5050
if (fanState == false) {
5151
// turn off the Fan
52-
digitalWrite(dcMotorPin, LOW);
52+
#ifndef RGB_BUILTIN
53+
// after analogWrite(), it is necessary to set the GPIO to digital mode first
54+
pinMode(ledPin, OUTPUT);
55+
#endif
56+
digitalWrite(dcMotorPin, LOW);
5357
} else {
5458
// set the Fan speed
5559
uint8_t fanDCMotorPWM = map(speedPercent, 0, 100, 0, 255);

0 commit comments

Comments
 (0)