public class LED extends GPIOComponent
This component only uses a Gpio pin.
Example of use: LEDExample
Datasheet (example): LED,
Modifier and Type | Field and Description |
---|---|
protected com.pi4j.io.gpio.GpioPinDigitalOutput |
digitalOutput |
gpio
Constructor and Description |
---|
LED(GPIOPin pin)
Constructor for a LED using a specific Gpio pin.
|
LED(GPIOPin pin,
java.lang.String name)
Constructor for a LED using a specific Gpio pin,
and a specific name.
|
Modifier and Type | Method and Description |
---|---|
void |
off()
Turns the LED off.
|
void |
on()
Turns the LED on.
|
void |
pulse(long millis)
Turns the LED on for millis milliseconds and then off.
|
void |
toggle()
Toggles the LED state.
|
getType
public LED(GPIOPin pin, java.lang.String name)
pin
- the pin used to manage the LED.name
- the name used to print specific pi4j logs.public LED(GPIOPin pin)
pin
- the Gpio pin used to manage the LED.public void on()
public void off()
public void toggle()
Turns on if OFF. Turns off if ON.
public void pulse(long millis)
millis
- the duration of the ON period, in milliseconds.