Provides general purpose input and output (GPIO) functions.
More...
|
void | pinMode (uint16_t pin, uint8_t mode) |
| Set the mode of a GPIO pin. More...
|
|
void IRAM_ATTR | digitalWrite (uint16_t pin, uint8_t val) |
| Set a digital output. More...
|
|
uint8_t IRAM_ATTR | digitalRead (uint16_t pin) |
| Get the value of a digital input. More...
|
|
void IRAM_ATTR | pullup (uint16_t pin) |
| Enable pull-up on digital input. More...
|
|
void IRAM_ATTR | noPullup (uint16_t pin) |
| Disable pull-up on digital input. More...
|
|
bool IRAM_ATTR | isInputPin (uint16_t pin) |
| Check if GPIO is an input. More...
|
|
unsigned long | pulseIn (uint16_t pin, uint8_t state, unsigned long timeout=1000000L) |
| Measures duration of pulse on GPIO. More...
|
|
uint16_t | analogRead (uint16_t pin) |
|
Provides general purpose input and output (GPIO) functions.
- See also
- Pulse width modulation
uint8_t IRAM_ATTR digitalRead |
( |
uint16_t |
pin | ) |
|
Get the value of a digital input.
- Parameters
-
- Return values
-
void IRAM_ATTR digitalWrite |
( |
uint16_t |
pin, |
|
|
uint8_t |
val |
|
) |
| |
Set a digital output.
- Parameters
-
pin | GPIO pin to set |
val | Value to set [0 | 1] |
bool IRAM_ATTR isInputPin |
( |
uint16_t |
pin | ) |
|
Check if GPIO is an input.
- Parameters
-
- Return values
-
bool | True if GPIO is an input |
void IRAM_ATTR noPullup |
( |
uint16_t |
pin | ) |
|
Disable pull-up on digital input.
- Parameters
-
pin | GPIO to disable pull-up resistor |
void pinMode |
( |
uint16_t |
pin, |
|
|
uint8_t |
mode |
|
) |
| |
Set the mode of a GPIO pin.
- Parameters
-
pin | GPIO pin to configure |
mode | Mode of pin [INPUT | INPUT_PULLUP | OUTPUT] |
- Todo:
- ESP8266 supports pull-down on GPIO 0-15
void IRAM_ATTR pullup |
( |
uint16_t |
pin | ) |
|
Enable pull-up on digital input.
- Parameters
-
pin | GPIO to enable pull-up resistor |
unsigned long pulseIn |
( |
uint16_t |
pin, |
|
|
uint8_t |
state, |
|
|
unsigned long |
timeout = 1000000L |
|
) |
| |
Measures duration of pulse on GPIO.
- Parameters
-
pin | GPIO to measure |
state | State of pulse to measure [HIGH | LOW] |
timeout | Maximum duration of pulse |
- Return values
-
unsigned long | Pulse duration in microseconds |
- Note
- Works on pulses from 2-3 microseconds to 3 minutes in length.
-
Must be called at least a few dozen microseconds before the start of the pulse.