ESP32 Deep Sleep External Wake Up Query

Phillip
Posts: 13
Joined: Thu Aug 25, 2022 11:57 pm

ESP32 Deep Sleep External Wake Up Query

Postby Phillip » Mon Feb 26, 2024 4:19 pm

In the Deep Sleep function call:

Code: Select all

esp_sleep_enable_ext0_wakeup(GPIO_NUM_X, level)
Is it possible to determine the logic state of 'GPIO_NUM_X'?

I have tried the followig -

Code: Select all

if (GPIO_NUM_X == HIGH)
{
       do something here ...
}
but this does not execute.

Any help with this would be much appreciated.

Thank you.

Phillip
Posts: 13
Joined: Thu Aug 25, 2022 11:57 pm

Re: ESP32 Deep Sleep External Wake Up Query

Postby Phillip » Tue Feb 27, 2024 3:51 am

To those who may have some interest in this issue, I can up with this Plan B solution.

I solved my problem by using another GPIO in parallel with the 'GPIO_NUM_X' pin. IOW's, I connected my 'trigger' lead to both the 'GPIO_NUM_X' pin and another GPIO pin. They both go HIGH/LOW simultaneously.

I needed to know when the GPIO_NUM_X went HIGH and performing a digitalRead() on the second interconnected pin gave me the info I needed.

Problem solved.

Thanks!

lbernstone
Posts: 673
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32 Deep Sleep External Wake Up Query

Postby lbernstone » Tue Feb 27, 2024 6:07 pm

The ext1 peripheral can identify which pin caused the wakeup, but does not work exactly like ext0.

Phillip
Posts: 13
Joined: Thu Aug 25, 2022 11:57 pm

Re: ESP32 Deep Sleep External Wake Up Query

Postby Phillip » Tue Feb 27, 2024 6:31 pm

@Ibernstone

Thanks for your post.

I'm a bit embarrassed because I reviewed the original sketch that I was having the 'GPIO_NUM_33' problem with and it seems that my

Code: Select all

reading = digitalRead(GPIO_NUM_33);
code line was mistyped or something else. I retyped that code line and all was good.

The lines seemed identical but apparently they were not. That line now works as expected and I am good to go. Live and learn.

Thanks again.

Who is online

Users browsing this forum: No registered users and 136 guests