public class PCA9685 extends AbstractDeviceFactory implements PwmOutputDeviceFactoryInterface, Closeable
Modifier and Type | Class and Description |
---|---|
static class |
PCA9685.PCA9685BoardPinInfo |
deviceStates, shutdown
Constructor and Description |
---|
PCA9685(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,
float initialValue) |
BoardPinInfo |
getBoardPinInfo() |
String |
getName() |
int |
getPwmFrequency(int channel) |
float |
getValue(int channel) |
void |
setPwmFrequency(int channel,
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, isDeviceOpened, isShutdown, shutdown
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
provisionPwmOutputDevice
createPinKey, deviceClosed, deviceOpened, isDeviceOpened, isShutdown, shutdown
public PCA9685(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 Closeable
close
in interface AutoCloseable
RuntimeIOException
public void closeChannel(int channel) throws RuntimeIOException
RuntimeIOException
public PwmOutputDeviceInterface createPwmOutputDevice(String key, PinInfo pinInfo, 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 getPwmFrequency(int channel)
getPwmFrequency
in interface PwmOutputDeviceFactoryInterface
public void setPwmFrequency(int channel, int pwmFrequency)
setPwmFrequency
in interface PwmOutputDeviceFactoryInterface
public BoardPinInfo getBoardPinInfo()
getBoardPinInfo
in interface DeviceFactoryInterface
Copyright © 2016–2017 mattjlewis. All rights reserved.