public class RgbLed extends Object implements Closeable
Constructor and Description |
---|
RgbLed(GpioDeviceFactoryInterface deviceFactory,
int redPin,
int greenPin,
int bluePin) |
RgbLed(int redPin,
int greenPin,
int bluePin) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean[] |
getValues()
Get the state of all LEDs.
|
void |
off()
Turn all LEDs off.
|
void |
on()
Turn all LEDs on.
|
void |
setValues(boolean red,
boolean green,
boolean blue)
Set the state of all LEDs.
|
void |
toggle()
Toggle the state of all LEDs.
|
public RgbLed(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 RgbLed(GpioDeviceFactoryInterface 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 boolean[] getValues() throws RuntimeIOException
RuntimeIOException
- If an I/O error occurred.public void setValues(boolean red, boolean green, boolean blue) throws RuntimeIOException
red
- Red LED state.green
- Green LED state.blue
- Blue LED state.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.