Package com.diozero.devices
Class LedBarGraph
java.lang.Object
com.diozero.devices.LedBarGraph
- All Implemented Interfaces:
OutputDeviceInterface
,Closeable
,AutoCloseable
public class LedBarGraph extends Object implements OutputDeviceInterface, 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(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()
-
Constructor Details
-
LedBarGraph
public LedBarGraph(int... gpios) -
LedBarGraph
-
LedBarGraph
-
LedBarGraph
-
LedBarGraph
-
-
Method Details
-
on
public void on() -
off
public void off() -
toggle
public void toggle() -
blink
public void blink() -
blink
-
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 interfaceOutputDeviceInterface
- Parameters:
newValue
- Proportion of LEDs to light. 0..1 lights from left to right, 0..-1 lights from right to left.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
RuntimeIOException
-