Class LedBarGraph

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

public class LedBarGraph
extends java.lang.Object
implements OutputDeviceInterface, java.io.Closeable
  • Constructor Summary

    Constructors 
    Constructor Description
    LedBarGraph​(int... gpios)  
    LedBarGraph​(LED... leds)  
    LedBarGraph​(GpioDeviceFactoryInterface deviceFactory, boolean activeHigh, int... gpios)  
    LedBarGraph​(GpioDeviceFactoryInterface deviceFactory, int... gpios)  
    LedBarGraph​(java.util.List<LED> leds)  
  • Method Summary

    Modifier and Type Method Description
    void blink()  
    void blink​(float onTime, float offTime, int iterations, Action stopAction)  
    void close()  
    float getValue()
    Get the proportion of LEDs currently lit.
    void off()  
    void on()  
    void setValue​(float newValue)
    Light a proportion of the LEDs using value as a percentage.
    void toggle()  

    Methods inherited from class java.lang.Object

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

  • Method Details

    • on

      public void on()
    • off

      public void off()
    • toggle

      public void toggle()
    • blink

      public void blink()
    • blink

      public void blink​(float onTime, float offTime, int iterations, Action stopAction)
    • getValue

      public float getValue()
      Get the proportion of LEDs currently lit.
      Returns:
      Proportion of LEDs lit. 0..1 if lit from left to right, 0..-1 if lit from right to left.
    • setValue

      public void setValue​(float newValue)
      Light a proportion of the LEDs using value as a percentage.
      Specified by:
      setValue in interface OutputDeviceInterface
      Parameters:
      newValue - Proportion of LEDs to light. 0..1 lights from left to right, 0..-1 lights from right to left.
    • close

      public void close() throws RuntimeIOException
      Specified by:
      close in interface java.lang.AutoCloseable
      Specified by:
      close in interface java.io.Closeable
      Throws:
      RuntimeIOException