public class PCA9685 extends AbstractDeviceFactory implements PwmOutputDeviceFactoryInterface
Modifier and Type | Class and Description |
---|---|
static class |
PCA9685.PCA9685BoardPinInfo |
closed, deviceStates
Constructor and Description |
---|
PCA9685(int pwmFrequency) |
PCA9685(int controller,
int pwmFrequency) |
PCA9685(int controller,
int address,
int pwmFrequency) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
closeChannel(int channel) |
PwmOutputDeviceInterface |
createPwmOutputDevice(String key,
PinInfo pinInfo,
int pwmFrequency,
float initialValue) |
BoardPinInfo |
getBoardPinInfo() |
int |
getBoardPwmFrequency() |
String |
getName() |
float |
getValue(int channel) |
void |
setBoardPwmFrequency(int pwmFrequency) |
void |
setServoPulseWidthMs(int channel,
double pulseWidthMs)
Set the pulse duration (micro-seconds)
E.g.
|
void |
setValue(int channel,
float value)
Set PWM output on a specific channel, value must be 0..1
|
createPinKey, deviceClosed, deviceOpened, getDevice, isClosed, isDeviceOpened
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
provisionPwmOutputDevice
createPinKey, deviceClosed, deviceOpened, isClosed, isDeviceOpened
public PCA9685(int pwmFrequency) throws RuntimeIOException
RuntimeIOException
public PCA9685(int controller, int pwmFrequency) throws RuntimeIOException
RuntimeIOException
public PCA9685(int controller, int address, int pwmFrequency) throws RuntimeIOException
RuntimeIOException
public void setServoPulseWidthMs(int channel, double pulseWidthMs) throws RuntimeIOException
channel
- PWM channelpulseWidthMs
- The desired pulse width in milli-secondsRuntimeIOException
- if an I/O error occurspublic String getName()
getName
in interface DeviceFactoryInterface
public void close() throws RuntimeIOException
close
in interface DeviceFactoryInterface
close
in interface Closeable
close
in interface AutoCloseable
close
in class AbstractDeviceFactory
RuntimeIOException
public void closeChannel(int channel) throws RuntimeIOException
RuntimeIOException
public PwmOutputDeviceInterface createPwmOutputDevice(String key, PinInfo pinInfo, int pwmFrequency, float initialValue) throws RuntimeIOException
createPwmOutputDevice
in interface PwmOutputDeviceFactoryInterface
RuntimeIOException
public float getValue(int channel) throws RuntimeIOException
RuntimeIOException
public void setValue(int channel, float value) throws RuntimeIOException
channel
- PWM channelvalue
- Must be 0..1RuntimeIOException
- if an I/O error occurspublic int getBoardPwmFrequency()
getBoardPwmFrequency
in interface PwmOutputDeviceFactoryInterface
public void setBoardPwmFrequency(int pwmFrequency)
setBoardPwmFrequency
in interface PwmOutputDeviceFactoryInterface
public BoardPinInfo getBoardPinInfo()
getBoardPinInfo
in interface DeviceFactoryInterface
Copyright © 2016–2017 mattjlewis. All rights reserved.