ESP32-ULP Read GPIO

numan9803
Posts: 3
Joined: Tue Aug 17, 2021 12:55 pm

ESP32-ULP Read GPIO

Postby numan9803 » Tue Aug 24, 2021 1:35 pm

Hello everyone, I'm just a beginner to esp32-ulp. Now i am trying to configure a button as input on ulp-code and read and blinking a led on main code(C). actually i tried this app but i cant run. So, is there anyone help me for this issue ? is there any example for it? Thanks in advance.

filo_gr
Posts: 18
Joined: Wed Jul 28, 2021 12:25 pm

Re: ESP32-ULP Read GPIO

Postby filo_gr » Fri Sep 10, 2021 7:32 am

Firstly configure configure inputs and ouputs with:
output pin: ESP_ERROR_CHECK(gpio_set_direction(""number of the pin"", GPIO_MODE_OUTPUT));
input pin: ESP_ERROR_CHECK(gpio_set_direction(""number of the pin"", GPIO_MODE_INPUT));

If you want to write a 0 on a pin set as output:
ESP_ERROR_CHECK(gpio_set_level(""number of the pin"", 0));

If you want to read the value on a pin set as input:
variable = gpio_get_level(""number of the pin"");

Who is online

Users browsing this forum: Google [Bot] and 42 guests