public class MaestroServoProvider extends Object implements ServoProvider
Modifier and Type | Class and Description |
---|---|
static class |
MaestroServoProvider.InterfaceType |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BAUDRATE |
static int |
DEFAULT_DEVICE_ADDRESS |
protected Serial |
device |
protected MaestroServoProvider.InterfaceType |
interfaceType |
static Map<Pin,String> |
PIN_MAP |
static String |
PROVIDER_NAME |
static Map<String,Pin> |
REVERSE_PIN_MAP |
protected Map<Pin,MaestroServoDriver> |
servoDrivers |
static String |
UART_DEVICE |
static String |
USB_DEVICE |
Constructor and Description |
---|
MaestroServoProvider() |
MaestroServoProvider(MaestroServoProvider.InterfaceType interfaceType) |
MaestroServoProvider(MaestroServoProvider.InterfaceType interfaceType,
int deviceAddress,
int baudrate) |
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
List<Pin> |
getDefinedServoPins()
This method returns a list of pins this provider implementation
can drive.
|
protected int |
getError() |
ServoDriver |
getServoDriver(int address) |
ServoDriver |
getServoDriver(Pin servoPin)
Returns new instance of
MaestroServoDriver . |
protected int |
getServoPosition(int pinAddress) |
protected void |
goHome() |
protected boolean |
isMoving() |
protected void |
setAcceleration(int pinAddress,
int value) |
protected void |
setServoPosition(int pinAddress,
int value) |
protected void |
setSpeed(int pinAddress,
int value) |
public static final String PROVIDER_NAME
public static final String USB_DEVICE
public static final String UART_DEVICE
public static final int DEFAULT_DEVICE_ADDRESS
public static final int DEFAULT_BAUDRATE
protected MaestroServoProvider.InterfaceType interfaceType
protected Serial device
protected Map<Pin,MaestroServoDriver> servoDrivers
public MaestroServoProvider() throws SerialPortException, IOException
SerialPortException
IOException
public MaestroServoProvider(MaestroServoProvider.InterfaceType interfaceType) throws SerialPortException, IOException
SerialPortException
IOException
public MaestroServoProvider(MaestroServoProvider.InterfaceType interfaceType, int deviceAddress, int baudrate) throws SerialPortException, IOException
SerialPortException
IOException
public void dispose()
public List<Pin> getDefinedServoPins() throws IOException
ServoProvider
getDefinedServoPins
in interface ServoProvider
IOException
- in case there is an error providing list of pinspublic ServoDriver getServoDriver(Pin servoPin) throws IOException
MaestroServoDriver
.getServoDriver
in interface ServoProvider
servoPin
- servo pin.MaestroServoDriver
.IOException
- in case that servo driver cannnot be provided for asked pinpublic ServoDriver getServoDriver(int address) throws IOException
IOException
protected void setServoPosition(int pinAddress, int value)
protected int getServoPosition(int pinAddress)
protected void setSpeed(int pinAddress, int value)
protected void setAcceleration(int pinAddress, int value)
protected boolean isMoving()
protected int getError()
protected void goHome()
Copyright © 2012–2021 Pi4J. All rights reserved.