public class SoftwareServo
extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_PULSE |
static int |
DEFAULT_MIN_PULSE |
Constructor and Description |
---|
SoftwareServo(PApplet parent)
Opens a servo motor
|
Modifier and Type | Method and Description |
---|---|
void |
attach(int pin)
Attaches a servo motor to a GPIO pin
|
void |
attach(int pin,
int minPulse,
int maxPulse)
Attaches a servo motor to a GPIO pin using custom pulse widths
|
boolean |
attached()
Returns whether a servo motor is attached to a pin
|
void |
close()
Closes a servo motor
|
void |
detach()
Detatches a servo motor from a GPIO pin
|
void |
write(float angle)
Moves a servo motor to a given orientation
|
public static final int DEFAULT_MIN_PULSE
public static final int DEFAULT_MAX_PULSE
public SoftwareServo(PApplet parent)
parent
- typically use "this"public void close()
public void attach(int pin)
pin
- GPIO pinpublic void attach(int pin, int minPulse, int maxPulse)
minPulse
- minimum pulse width in microseconds (default: 544, same as on Arduino)maxPulse
- maximum pulse width in microseconds (default: 2400, same as on Arduino)public void write(float angle)
angle
- angle in degrees (controls speed and direction on continuous-rotation servos)public boolean attached()
public void detach()