From d248cccf81d5a7a624a867dcc7bc8f4141933ec4 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sun, 1 Nov 2020 10:16:29 +0100 Subject: [PATCH] special treatment for Pololu board --- MotorDriver.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MotorDriver.cpp b/MotorDriver.cpp index 65619ff..ae832e9 100644 --- a/MotorDriver.cpp +++ b/MotorDriver.cpp @@ -55,6 +55,12 @@ MotorDriver::MotorDriver(byte power_pin, byte signal_pin, byte signal_pin2, int8 } void MotorDriver::setPower(bool on) { + if (brakePin == -4 && on) { + // toggle brake before turning power on - resets overcurrent error + // on the Pololu board if brake is wired to ^D2. + setBrake(true); + setBrake(false); + } WritePin(powerPin, on ? HIGH : LOW); }