public class PwmLed extends PwmOutputDevice
INFINITE_ITERATIONS
gpio
Constructor and Description |
---|
PwmLed(int gpio) |
PwmLed(int gpio,
float initialValue) |
PwmLed(PwmOutputDeviceFactoryInterface deviceFactory,
int gpio) |
PwmLed(PwmOutputDeviceFactoryInterface deviceFactory,
int gpio,
float initialValue) |
Modifier and Type | Method and Description |
---|---|
void |
blink()
Blink the LED on and off indefinitely.
|
void |
blink(float onTime,
float offTime,
int iterations,
boolean background)
Blink the LED on and off repeatedly.
|
boolean |
isLit()
Return true if the PWM value is >0.
|
void |
pulse()
Pulse the LED on and off indefinitely in a background thread with a fade time of 1 second.
|
void |
pulse(float fadeTime,
int steps,
int iterations,
boolean background)
Pulse the LED on and off repeatedly.
|
close, fadeInOutLoop, getValue, isOn, off, on, onOffLoop, setValue, setValueInternal, toggle
getGpio
public PwmLed(int gpio) throws RuntimeIOException
gpio
- The GPIO to which the LED is attached to.RuntimeIOException
- If an I/O error occurred.public PwmLed(int gpio, float initialValue) throws RuntimeIOException
gpio
- The GPIO to which the LED is attached to.initialValue
- Initial PWM output value (range 0..1).RuntimeIOException
- If an I/O error occurred.public PwmLed(PwmOutputDeviceFactoryInterface deviceFactory, int gpio) throws RuntimeIOException
deviceFactory
- Device factory to use to provision this device.gpio
- The GPIO to which the LED is attached to.RuntimeIOException
- If an I/O error occurred.public PwmLed(PwmOutputDeviceFactoryInterface deviceFactory, int gpio, float initialValue) throws RuntimeIOException
deviceFactory
- Device factory to use to provision this device.gpio
- The GPIO to which the LED is attached to.initialValue
- Initial PWM output value (range 0..1).RuntimeIOException
- If an I/O error occurred.public void blink() throws RuntimeIOException
RuntimeIOException
- If an I/O error occurred.public void blink(float onTime, float offTime, int iterations, boolean background) throws RuntimeIOException
onTime
- On time in seconds.offTime
- Off time in seconds.iterations
- Number of iterations. Set to <0 to blink indefinitely.background
- If true start a background thread to control the blink and
return immediately. If false, only return once the blink
iterations have finished.RuntimeIOException
- If an I/O error occurred.public void pulse() throws RuntimeIOException
RuntimeIOException
- If an I/O error occurred.public void pulse(float fadeTime, int steps, int iterations, boolean background) throws RuntimeIOException
fadeTime
- Time in seconds from fully on to fully off.steps
- Number of steps between fully on to fully off.iterations
- Number of times to fade in and out.background
- If true start a background thread to control the blink and
return immediately. If false, only return once the blink
iterations have finished.RuntimeIOException
- If an I/O error occurred.public boolean isLit() throws RuntimeIOException
RuntimeIOException
- If an I/O error occurred.Copyright © 2016–2017 mattjlewis. All rights reserved.