142 if ( angleArg < 0) angleArg = 0;
143 if ( angleArg > 180) angleArg = 180;
153 uint8_t count = 0, i = 0;
156 static unsigned long lastRefresh = 0;
157 unsigned long m = millis();
160 if ( m >= lastRefresh && m < lastRefresh + 20)
return;
164 if ( count == 0)
return;
173 for ( i = 1; i < count; i++) {
190 TCCR1B &= ~(1 << CS10);
192 for ( i = 0; i < count; i++) digitalWrite( s[i]->
pin, 1);
194 uint8_t start = TCNT0;
199 for ( i = 0; i < count; i++) {
200 uint16_t go = start + s[i]->
pulse;
206 if ( now < last) base += 256;
209 if(base + now >= go - 16)
214 if ( base+now > go) {
215 digitalWrite( s[i]->
pin,0);
221 TCCR1B |= (1 << CS10);
void detach()
Detaches the servo motor from the uStepper.
void setMaximumPulse(uint16_t t)
Sets the maximum pulse.
uint8_t attach(int pinArg)
Attaches the servo motor to a specific pin.
class uStepperServo * next
Prototype of class for ustepper servo.
static void refresh()
Updates servo output pins.
uStepperServo()
Constructor for servo class.
Function prototypes and definitions for the uStepper Servo library.
void write(int angleArg)
Specify angle of servo motor.
void setMinimumPulse(uint16_t t)
Sets the minimum pulse.
static uStepperServo * first