Closed abhi-sachdeva closed 1 year ago
This forum is for issues with the code in this repo. Please ask general programming questions at https://esp32.com
This forum is for issues with the code in this repo. Please ask general programming questions at https://esp32.com
Posted it there too, but I have posted other times as well and nobody replies with any help
This is not an issue.
But, I'll suggest a few things for your application:
buttonPin2
instead of checking its state in loop()
Good Luck!
Closing as answered, if needed you can reopen.
Board
ESP32-C3-DevKit-M1
Device Description
The dev kit is mounted on a breadboard. there is one push button wired to gpio2 such that pressing it would initiate ble pairing. Once paired the device goes to sleep. The second push button is wired to gpio3 and is the interrupt button to wake up the esp (esp_gpio_wakeup_gpio_low). This button also controls 2 different LEDs.
Hardware Configuration
The blue LED for ble is connected to gpio7 and the green/red LEDs are connected to gpio 5 & 6 respectively. Each push button has a pull down resistor of 10kohms and each led has a resistor of 220ohms.
Version
latest master (checkout manually)
IDE Name
Arduino IDE
Operating System
Windows 10
Flash frequency
80Mhz
PSRAM enabled
yes
Upload speed
921600
Description
I have a slight problem in my code such that my LED does not illuminate immediately after deep sleep. The wakeup reason is GPIO go low so that when a button is depressed, the esp will wake up. That same button is also supposed to turn the LED on which is why I have implemented a counter so that it can turn on on the first depress. However, what happens is that the depress wakes up the esp and does not increment the counter so it needs an additional press/depress for the led to turn on. Is there a way I can make the led turn on at the same time as the esp waking up without using an additional button? Perhaps a way to increment the counter at the same time that the esp wakes up? Thanks for the help!
Expected Behavior: BLE connects and blue LED turns off and the esp goes to sleep. Second button is depressed and the esp wakes up and turns on a green led at the same time, a second push of that button turns off the green led and illuminates the red one.
Sketch
Debug Message
Other Steps to Reproduce
I have also tried to use the preferences.h library to store the counter, but I think I may have implemented that wrong as well. Any help on getting the LED to turn on at the same time as the board wakes up from deep sleep is really appreciated!
I have checked existing issues, online documentation and the Troubleshooting Guide