Skip to content
Prev Previous commit
Next Next commit
Remove possible jerk due to force-cancelling duty cycle.
  • Loading branch information
dok-net committed Oct 31, 2020
commit e7695a9e2a04b288d27f7ee38d73e1b1e3ca4f2f
3 changes: 2 additions & 1 deletion libraries/Servo/src/Servo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ void Servo::detach()
{
if (_attached) {
_servoMap &= ~(1 << _pin);
startWaveform(_pin, 0, REFRESH_INTERVAL, 1);
delay(REFRESH_INTERVAL / 1000); // long enough to complete active period under all circumstances.
stopWaveform(_pin);
_attached = false;
_valueUs = DEFAULT_NEUTRAL_PULSE_WIDTH;
digitalWrite(_pin, LOW);
}
}

Expand Down