public class PCA9685 extends AbstractDeviceFactory implements PwmOutputDeviceFactoryInterface, Closeable
deviceStates
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) |
String |
getName() |
int |
getPwmFrequency(int pinNumber) |
float |
getValue(int channel) |
PwmOutputDeviceInterface |
provisionPwmOutputPin(int channel,
float initialValue) |
void |
setPwmFrequency(int pinNumber,
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
|
closeAll, deviceClosed, deviceOpened, getDevice, isDeviceOpened
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
closeAll, deviceClosed, deviceOpened, isDeviceOpened
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 provisionPwmOutputPin(int channel, float initialValue) throws RuntimeIOException
provisionPwmOutputPin
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 pinNumber)
getPwmFrequency
in interface PwmOutputDeviceFactoryInterface
public void setPwmFrequency(int pinNumber, int pwmFrequency)
setPwmFrequency
in interface PwmOutputDeviceFactoryInterface
Copyright © 2016 mattjlewis. All rights reserved.