Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Servo.h should define MAX_SERVOS #6997

Closed
cburn opened this issue Jan 7, 2020 · 0 comments · Fixed by #6999
Closed

Servo.h should define MAX_SERVOS #6997

cburn opened this issue Jan 7, 2020 · 0 comments · Fixed by #6999

Comments

@cburn
Copy link

cburn commented Jan 7, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant