ESP32 with LCD, SERVO MOTOR, LED,DHT22

Thread Starter

jlosa

Joined Sep 6, 2021
2
Hi,
I'm using LCD to display temperature and humidity constantly but when I turn on or off servo motor or led I want to display for five seconds the information about this, I tried to do with if else but I didn't work and I also don't want to use delay.Do you have any idea how I could do this ?
 

Irving

Joined Jan 30, 2016
2,198
There are two (at least) approaches to this.

  • The simplest is to implement your main loop as a time-event-driven state machine, where actions on the servo or LED lead to temporary alternate states to the main program flow states. Have a look at this how-to for a start.
  • The second, more complex but arguably more flexible, approach is to implement your code as a set of asynchronous but synchronised parallel tasks using the task scheduling capabilities of the freeRTOS operating system embedded in the ESP32 firmware.

I'd recommend approach 1 intially. If, after reading the info on that link, you need more guidance, give me a shout.
 
Top