hi,
I have issues with my 2 Dues + PCA9685 Servo board: it makes no servo work at all!
Instead, trying the same Sketch with a Mega2560, it's all fine though.
With my Feather M4 the code is also working fine, by 3.3V Vc.
The PCA is designed for 3-5V Vc and signal levels, but even if I supply it from the Due by 5V Vc it still don't work.
This is the code, what's wrong with the Due?
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define MIN_PULSE_WIDTH 650
#define MAX_PULSE_WIDTH 2350
#define DEFAULT_PULSE_WIDTH 1500
#define FREQUENCY 50
uint8_t servonum = 0;
void setup() {
Serial.begin(115200);
Serial.println("16 channel Servo test!");
pwm.begin();
pwm.setPWMFreq(FREQUENCY);
}
int pulseWidth(int angle) {
int pulse_wide, analog_value;
pulse_wide = map(angle, 0, 180, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
analog_value = int(float(pulse_wide) / 1000000 * FREQUENCY * 4096);
Serial.println(analog_value);
return analog_value;
}
void loop() {
pwm.setPWM(0, 0, pulseWidth(0));
delay(2000);
pwm.setPWM(0, 0, pulseWidth(120));
delay(2000);
pwm.setPWM(0, 0, pulseWidth(90));
delay(2000);
}