Class RgbLed

java.lang.Object
com.diozero.devices.RgbLed
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable

public class RgbLed
extends java.lang.Object
implements java.io.Closeable
Three pin controlled RGB LED. 4 3 2 1 1 Red 2 Ground 3 Green 4 Blue
  • Constructor Summary

    Constructors 
    Constructor Description
    RgbLed​(int redPin, int greenPin, int bluePin)  
    RgbLed​(GpioDeviceFactoryInterface deviceFactory, int redPin, int greenPin, int bluePin)  
  • Method Summary

    Modifier and Type Method 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RgbLed

      public RgbLed​(int redPin, int greenPin, int bluePin) throws RuntimeIOException
      Parameters:
      redPin - GPIO for the red LED.
      greenPin - GPIO for the green LED.
      bluePin - GPIO for the blue LED.
      Throws:
      RuntimeIOException - If an I/O error occurred.
    • RgbLed

      public RgbLed​(GpioDeviceFactoryInterface deviceFactory, int redPin, int greenPin, int bluePin) throws RuntimeIOException
      Parameters:
      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.
      Throws:
      RuntimeIOException - If an I/O error occurred.
  • Method Details