Simple library to control up to 12 servos on Atmega328p microcontroller.
This library uses timer 1.
static void begin();
static void ISRpulseA();
static void ISRpulseB();
ISRpulseA() is in TIMER1_COMPA_vect routine
ISRpulseB() is in TIMER1_COMPB_vect routine
void activate(int8_t & port, int8_t & pin, int16_t angle);
- port: i.e PORTB
- pin i.e PB2
- angle: Angle the servo will go to after activation
Servo will not activate if there are 12 active servos or if other servo uses given port and pin combination.
bool isActive();
void deactivate();
void setMinAngle(int16_t a);
void setMaxAngle(int16_t a);
void setMinPulse(uint16_t p);
void setMaxPulse(uint16_t p);
void setUsableMinAngle(int16_t a);
void setUsableMaxAngle(int16_t a);
void setAngle(int16_t a);
void setPulse(uint16_t p);
static uint8_t getServoNumber();
- returns: Number of servos that are active
int16_t getMinAngle();
int16_t getMaxAngle();
uint16_t getMinPulse();
uint16_t getMaxPulse();
int16_t getUsableMinAngle();
int16_t getUsableMaxAngle();
int16_t getAngle();
uint16_t getPulse();