35#define SERVO_NOT_ATTACHED (0xFF)
38#define SERVO_MIN_ANGLE (0)
39#define SERVO_MAX_ANGLE (180)
41#define SERVO_MIN_PULSE_WIDTH (544)
42#define SERVO_MAX_PULSE_WIDTH (2400)
44#define SERVO_DEFAULT_PULSE_WIDTH (1500)
45#define SERVO_REFRESH_INTERVAL (2500)
46#define SERVO_REFRESH_FREQUENCY (1000000L / SERVO_REFRESH_INTERVAL)
101 uint16_t min_pulse_width = SERVO_MIN_PULSE_WIDTH,
102 uint16_t max_pulse_width = SERVO_MAX_PULSE_WIDTH,
103 uint16_t min_angle = SERVO_MIN_ANGLE,
104 uint16_t max_angle = SERVO_MAX_ANGLE);
151 bool attached()
const {
return this->pin_ != SERVO_NOT_ATTACHED; }
bool attached() const
Check if this instance is attached to a servo.
Definition: Servo.h:151
bool attach(uint8_t pin, uint16_t min_pulse_width=SERVO_MIN_PULSE_WIDTH, uint16_t max_pulse_width=SERVO_MAX_PULSE_WIDTH, uint16_t min_angle=SERVO_MIN_ANGLE, uint16_t max_angle=SERVO_MAX_ANGLE)
Associate this instance with a servomotor whose input is connected to pin.
Servo()
Construct a new Servo instance.
uint8_t attachedPin() const
Get the pin this instance is attached to.
Definition: Servo.h:159
void write(uint16_t angle)
Set the servomotor target angle.
~Servo()
Destructor a Servo instance.
void writeMicroseconds(uint16_t pulse_width)
Set the pulse width, in microseconds.
bool detach()
Stop driving the servo pulse train.