Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ServoFirmata.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ boolean ServoFirmata::handleSysex(byte command, byte argc, byte* argv)

void ServoFirmata::attach(byte pin, int minPulse, int maxPulse)
{
if (! IS_PIN_SERVO(pin)) {return;}
Servo *servo = servos[PIN_TO_SERVO(pin)];
if (!servo) {
servo = new Servo();
Expand All @@ -130,6 +131,7 @@ void ServoFirmata::attach(byte pin, int minPulse, int maxPulse)

void ServoFirmata::detach(byte pin)
{
if (! IS_PIN_SERVO(pin)) {return;}
// Servo not available for this pin?
if (PIN_TO_SERVO(pin) >= sizeof(servos) / sizeof(servos[0])) {
return;
Expand Down