public class GPIO
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
GPIO.Mode
Specify the pin mode.
|
| Constructor and Description |
|---|
GPIO() |
| Modifier and Type | Method and Description |
|---|---|
static int |
getAnalogValue(int port,
int pin)
Gets the value of the analog pin (a value between
0 and the
targeted hardware ADC maximum value).The returned value is undefined when the pin is not configured or configured as digital pin. |
static boolean |
getDigitalValue(int port,
int pin)
Gets the value of the digital pin.
The returned value is undefined when the pin is not configured or configured as analog pin. |
static void |
setAnalogValue(int port,
int pin,
int percentage)
Sets a value on the analog pin.
|
static void |
setDigitalValue(int port,
int pin,
boolean value)
Sets a value on the digital pin.
|
static void |
setMode(int port,
int pin,
GPIO.Mode mode)
Configures the pin mode using the enumeration
GPIO.Mode. |
public static void setMode(int port,
int pin,
GPIO.Mode mode)
GPIO.Mode.port - port identifierpin - pin numbermode - pin modejava.lang.IllegalArgumentException - when the combination port / pin is unreachablejava.lang.NullPointerException - when mode is nullpublic static boolean getDigitalValue(int port,
int pin)
port - port identifierpin - pin numbertrue when the GPIO digital value is currently
high.java.lang.IllegalArgumentException - when the combination port / pin is unreachablepublic static void setDigitalValue(int port,
int pin,
boolean value)
port - port identifierpin - pin numbervalue - digital pin value: true for high,
false for low.java.lang.IllegalArgumentException - when the combination port / pin is unreachablepublic static int getAnalogValue(int port,
int pin)
0 and the
targeted hardware ADC maximum value).port - port identifierpin - pin numberjava.lang.IllegalArgumentException - when the combination port / pin is unreachablepublic static void setAnalogValue(int port,
int pin,
int percentage)
port - port identifierpin - pin numberpercentage - percentage of analog pin value.java.lang.IllegalArgumentException - when the combination port / pin is unreachable or when the
percentage is invalid