Search code examples
arduinomotordriver

Arduino SoftwareServo and Init ESC's


I have 4 esc's hooked up and I want to control them using SoftwareServo.

I am able to control them with Servo.h by doing so:

  for(int i = 0; i < 4; i++)
    escS[i].attach(escPins[i]);
  for(int i = 0; i < 4; i++)
    escS[i].write(180);
  delay(2000);
  for(int i = 0; i < 4; i++)
    escS[i].write(90);
  delay(2000);

  escS[0].write(0);
  escS[1].write(0);
  escS[2].write(0);
  escS[3].write(0);

I have to do that to initialize the ESC's, but I am unable to achieve the same affect using SoftwareServo.h; I must be doing something wrong:

  for(int i = 0; i < 4; i++)
    escSS[i].attach(escPins[i]);
  for(int i = 0; i < 4; i++)
    escSS[i].write(180);
  SoftwareServo::refresh();
  delay(2000);
  for(int i = 0; i < 4; i++)
    escSS[i].write(90);
  SoftwareServo::refresh();
  delay(2000);

  escSS[0].write(0);
  escSS[1].write(0);
  escSS[2].write(0);
  escSS[3].write(0);

Solution

  • I was able to solve this by arming the ESC's using the Servo.h servos and then detaching them and attaching the SoftwareServo.h SoftwareServos to the same esc's and writing to them from then on.