Skip to content

Servo.h should define MAX_SERVOS #6997

Closed
@cburn

Description

@cburn

Basic Infos

  • [x ] This issue complies with the issue POLICY doc.
  • [x ] I have read the documentation at readthedocs and the issue is not addressed there.
  • [ x] I have tested that the issue is present in current master branch (aka latest git).
  • [ x] I have searched the issue tracker for a similar issue.
  • [ x] If there is a stack dump, I have decoded it.
  • [x ] I have filled out all fields below.

Platform

  • Hardware: [Feather HUZZAH ESP8266]
  • Core Version: [2.6.3]
  • Development Env: [Arduino IDE]
  • Operating System: [MacOS]

Settings in IDE

  • Module: [Adafruit Feather HUZZAH ESP8266]
  • Flash Mode: [other]
  • Flash Size: [4MB/0.5MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [rts]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [USB/SERIAL]
  • Upload Speed: [115200]

Problem Description

libraries/Servo/src/Servo.h should define MAX_SERVOS with the maximum number of servos the board can control.

The standard Arduino Servo library defines this here - https://github.com/arduino-libraries/Servo/blob/2e973f62ed4a3807d228a95eb241dd5c673767d2/src/Servo.h#L88

The firmata library uses this define to test for servo capability - https://github.com/firmata/arduino/blob/0b5236938ea8a9fd5ff8a50c503549276dd5e855/examples/StandardFirmataWiFi/StandardFirmataWiFi.ino#L170

Without this defined, the firmata library doesn't allow any servo control.

MCVE Sketch

From Arduino ISP, flash the Examples/Firmata/StandardFirmataWifi sketch to the board.

Attach a servo to pin 15.

Using node.js with 'firmata' and 'etherport-client' libs installed :

var Firmata = require("firmata").Board;
var EtherPortClient = require("etherport-client").EtherPortClient;
var board = new Firmata(new EtherPortClient({
  host: "<ip of board>",
  port: 3030
}));

board.on("ready", function() {
  this.pinMode(15, this.MODES.SERVO);
  this.servoWrite(15,90);
});

Servo should move to middle position, but it doesn't.

Adding
#define MAX_SERVOS 1
to Servo.h and recompiling and flashing StandardFirmataWifi.ino works.

I would make this change and submit a PR but I don't know how to determine the maximum servos supported by this board?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions