Adafruit Library
Public Member Functions | List of all members
ws_servo Class Reference

Interface for WipperSnapper servo control. More...

#include <ws_servo.h>

Public Member Functions

 ~ws_servo ()
 Destructor.
 
bool servo_attach (int pin, int minPulseWidth, int maxPulseWidth, int freq)
 Attaches a servo object to a pin. More...
 
void servo_detach (int pin)
 Detaches a servo from a pin and re-allocates the GPIO pin. More...
 
void servo_write (int pin, int value)
 Writes a pulse width to a servo pin. More...
 
servoComponentgetServoComponent (uint8_t pin)
 Attempts to get the servoComponent for the desired pin. More...
 

Detailed Description

Interface for WipperSnapper servo control.

Member Function Documentation

◆ servo_attach()

bool ws_servo::servo_attach ( int  pin,
int  minPulseWidth,
int  maxPulseWidth,
int  freq 
)

Attaches a servo object to a pin.

Parameters
pinDesired GPIO pin.
minPulseWidthMinimum pulsewidth, in uS.
maxPulseWidthMaximum pulsewidth, in uS.
freqServo Frequency, default is 50Hz
Returns
True if a servo is successfully attached to a pin, False otherwise

◆ servo_detach()

void ws_servo::servo_detach ( int  pin)

Detaches a servo from a pin and re-allocates the GPIO pin.

Parameters
pinDesired GPIO pin.

◆ servo_write()

void ws_servo::servo_write ( int  pin,
int  value 
)

Writes a pulse width to a servo pin.

Parameters
pinDesired GPIO pin.
valueDesired pulse width, in uS.

◆ getServoComponent()

servoComponent * ws_servo::getServoComponent ( uint8_t  pin)

Attempts to get the servoComponent for the desired pin.

Parameters
pinDesired GPIO pin.
Returns
servoComponent within _servos[] if found, nullptr otherwise.

The documentation for this class was generated from the following files: