esp32_gpio
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
esp32_gpio [2023/02/27 08:03] – created 192.168.1.66 | esp32_gpio [2023/02/27 14:04] (current) – 192.168.1.66 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | To set a pin as output, you must disable the modes " | + | Arduino code: |
- | < | + | * pinMode(GPIO, OUTPUT);\\ |
- | gpio_config_t io_conf; | + | * digitalWrite(GPIO, STATE);\\ |
- | io_conf.intr_type = GPIO_PIN_INTR_DISABLE;// | + | |
- | io_conf.mode = GPIO_MODE_OUTPUT;// | + | |
- | io_conf.pin_bit_mask = (1ULL<< | + | |
- | | + | |
- | io_conf.pull_up_en = GPIO_PULLUP_DISABLE;// | + | |
- | esp_err_t error=gpio_config(& | + | |
- | if(error!=ESP_OK){ | + | |
- | printf(" | + | |
- | } | + | |
- | </ | + | |
- | To set a pin as input, You must put the mode ( io_conf.mode | + | * pinMode(GPIO, INPUT);\\ |
+ | * digitalRead(GPIO);\\ | ||
- | < | ||
- | io_conf.intr_type = GPIO_PIN_INTR_DISABLE;// | ||
- | io_conf.mode = GPIO_MODE_INPUT;// | ||
- | io_conf.pin_bit_mask = (1ULL<< | ||
- | io_conf.pull_down_en = GPIO_PULLDOWN_ENABLE;// | ||
- | io_conf.pull_up_en = GPIO_PULLUP_DISABLE;// | ||
- | esp_err_t error=gpio_config(& | ||
- | |||
- | if(error!=ESP_OK){ | ||
- | printf(" | ||
- | } | ||
- | </ | ||
+ | The following modes are supported for the basic input and output:\\ | ||
+ | * INPUT sets the GPIO as input without pullup or pulldown (high impedance). | ||
+ | * OUTPUT sets the GPIO as output/read mode. | ||
+ | * INPUT_PULLDOWN sets the GPIO as input with the internal pulldown. | ||
+ | * INPUT_PULLUP sets the GPIO as input with the internal pullup. |
esp32_gpio.1677502982.txt.gz · Last modified: 2023/02/27 08:03 by 192.168.1.66