Hi, I'm programming the autopilot for my quadcopter based on Arduino Yun. I'm currently writing to the ESCs using the Servo Library and I'm facing an annoying issue.
In Servo.h I changed the REFRESH_INTERVAL to 8000 (8ms periods) in order to write PWM signals at 125Hz . but I can't get lower . I can't either decrease SERVOS_PER_TIMER, or it won't work.
#define Servo_VERSION 2 // software version of this library #define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo #define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo #define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached #define REFRESH_INTERVAL 8000 // minumim time to refresh servos in microseconds 125Hz #define SERVOS_PER_TIMER 12 // the maximum number of servos controlled by one timer
How can I get a 4ms periods? Do I need to change library?? Arduino Yun and Leonardo have the same 32u4 microcontroller and timers work differently from the Arduino Uno.