I'm trying to use an MKR 1010 to control a collection of six servos--for development, I'm using just one servo--plugged into an MKR Connector Carrier. The whole "circuit" is the 1010, the carrier, an MKR SD proto shield with nothing on it other than the SD RAM, and a Seeed Grove servo. The whole thing is powered by an external 12VDC power supply connected through the VIN and GND connectors on the connector carrier.
The test code a slight modification of the "sweep" sketch:
/* Sweep
by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Sweep
*/
#include <Servo.h>
Servo myservo;
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) {
digitalWrite(LED_BUILTIN, HIGH);
Serial.println(pos);
Serial.println(myservo.attached());
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(30); // waits 15ms for the servo to reach the position
digitalWrite(LED_BUILTIN, LOW);
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
digitalWrite(LED_BUILTIN, HIGH);
Serial.println(pos);
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(30); // waits 15ms for the servo to reach the position
digitalWrite(LED_BUILTIN, LOW);
}
}
The problem, of course, is that the servo isn't even twitching.
Has anyone ever tried this configuration, of servos connected through a connector carrier? Is this supposed to work?
The documentation for the connector carrier isn't explicit--is the D0 connector of the connector carrier connected to 1010 pin 9? (I don't have an oscilloscope so I can't see the waveform.)
The delay() of the original sweep sketch was 15ms, which isn't consistent with a 50Hz frequency for the PWM signal. Is that even relevant? I don't know how the servo myservo.write(pos) call works--does it emit just one pulse of the right duration, or is it continuous? If the latter, at what frequency? Does that matter?
Any help would be appreciated.