public class RgbPwmLed extends Object implements Closeable
Constructor and Description |
---|
RgbPwmLed(int redPin,
int greenPin,
int bluePin) |
RgbPwmLed(PwmOutputDeviceFactoryInterface deviceFactory,
int redPin,
int greenPin,
int bluePin) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
float[] |
getValues()
Get the value of all LEDs.
|
void |
off()
Turn all LEDs off.
|
void |
on()
Turn all LEDs on.
|
void |
setValues(float red,
float green,
float blue)
Set the value of all LEDs.
|
void |
toggle()
Toggle the state of all LEDs.
|
public RgbPwmLed(int redPin, int greenPin, int bluePin) throws RuntimeIOException
redPin
- GPIO for the red LED.greenPin
- GPIO for the green LED.bluePin
- GPIO for the blue LED.RuntimeIOException
- If an I/O error occurred.public RgbPwmLed(PwmOutputDeviceFactoryInterface deviceFactory, int redPin, int greenPin, int bluePin) throws RuntimeIOException
deviceFactory
- Device factory to use to provision this device.redPin
- GPIO for the red LED.greenPin
- GPIO for the green LED.bluePin
- GPIO for the blue LED.RuntimeIOException
- If an I/O error occurred.public void close()
close
in interface Closeable
close
in interface AutoCloseable
public float[] getValues() throws RuntimeIOException
RuntimeIOException
- If an I/O error occurred.public void setValues(float red, float green, float blue) throws RuntimeIOException
red
- Red LED value (0..1).green
- Green LED value (0..1).blue
- Blue LED value (0..1).RuntimeIOException
- If an I/O error occurred.public void on() throws RuntimeIOException
RuntimeIOException
- If an I/O error occurred.public void off() throws RuntimeIOException
RuntimeIOException
- If an I/O error occurred.public void toggle() throws RuntimeIOException
RuntimeIOException
- If an I/O error occurred.Copyright © 2016–2017 mattjlewis. All rights reserved.