#include <Servo.h>
Public Member Functions | |
| Servo () | |
| Construct a new Servo instance.  More... | |
| ~Servo () | |
| Destructor a Servo instance.  More... | |
| 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.  More... | |
| bool | detach () | 
| Stop driving the servo pulse train.  More... | |
| void | write (uint16_t angle) | 
| Set the servomotor target angle.  More... | |
| void | writeMicroseconds (uint16_t pulse_width) | 
| Set the pulse width, in microseconds.  More... | |
| uint16_t | read () const | 
| bool | attached () const | 
| Check if this instance is attached to a servo.  More... | |
| uint8_t | attachedPin () const | 
| Get the pin this instance is attached to.  More... | |
Class for interfacing with RC servomotors.
| Servo::Servo | ( | ) | 
Construct a new Servo instance.
The new instance will not be attached to any pin.
| Servo::~Servo | ( | ) | 
Destructor a Servo instance.
The instance will be detached if it is attached to any pin.
| bool Servo::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.
If this instance is already attached to a pin, it will be detached before being attached to the new pin. This function doesn't detach any interrupt attached with the pin's timer channel.
| pin | Pin connected to the servo pulse wave input. This pin must be capable of PWM output. | 
| min_pulse_width | Minimum pulse width to write to pin, in microseconds. This will be associated with a min_angle degree angle. Defaults to SERVO_DEFAULT_MIN_PW = 544. | 
| max_pulse_width | Maximum pulse width to write to pin, in microseconds. This will be associated with a max_angle degree angle. Defaults to SERVO_DEFAULT_MAX_PW = 2400. | 
| min_angle | Target angle (in degrees) associated with min_pulse_width. Defaults to SERVO_DEFAULT_MIN_ANGLE = 0. | 
| max_angle | Target angle (in degrees) associated with max_pulse_width. Defaults to SERVO_DEFAULT_MAX_ANGLE = 180. | 
@sideeffect May set pinMode(pin, PWM).
| bool Servo::detach | ( | ) | 
Stop driving the servo pulse train.
If not currently attached to a motor, this function has no effect.
| void Servo::write | ( | uint16_t | angle | ) | 
Set the servomotor target angle.
| angle | Target angle, in degrees. If the target angle is outside the range specified at attach() time, it will be clamped to lie in that range. | 
| void Servo::writeMicroseconds | ( | uint16_t | pulse_width | ) | 
Set the pulse width, in microseconds.
| pulse_width | Pulse width to send to the servomotor, in microseconds. If outside of the range specified at attach() time, it is clamped to lie in that range. | 
| uint16_t Servo::read | ( | ) | const | 
Get the servomotor's target angle, in degrees. This will lie inside the range specified at attach() time.
      
  | 
  inline | 
Check if this instance is attached to a servo.
      
  | 
  inline | 
Get the pin this instance is attached to.