I'm getting crazy with the Adafruit 16-Channel 12-bit PWM/Servo Shield and ESC connected to a brushless motor.
The connections are:
- Arduino powered by USB (Desktop PC)
- Shield I2C address changed to 0x41 with soldering
- ESC connected to the Shield connected on Port 4
- Shield receive power from the ESC directly
- The ESC receive power from a LiPo 3s (11.1V 2.2Ah)
The issue is that the motor sometime works, sometime doesn't work
I think I'm missing some "init" command, but really I do not know.
Here the code:
Code: Select all
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm;
#define PWM_MAX_REVERSE 100
#define PWM_MAX_FORWARD 500
#define PWM_ZERO PWM_MAX_REVERSE + ((PWM_MAX_FORWARD-PWM_MAX_REVERSE)/2)
#define PWMFREQ 50
void setup()
{
pwm = Adafruit_PWMServoDriver(0x41);
pwm.begin();
pwm.setPWMFreq(PWMFREQ);
pwm.setPWM(4,0,PWM_ZERO);
delay(2000);
pwm.setPWM(4,0, PWM_MAX_FORWARD );
delay(2000);
pwm.setPWM(4,0,PWM_MAX_REVERSE);
delay(2000);
pwm.setPWM(4,0,PWM_ZERO);
delay(2000);
}
void loop()
{
}