I have an Arduino Mega 2560 and i want to use it together with UTFT and DHT humidity and temperature sensor to display the temperature and humidity of the environment. The problem is that, when using an UTFT screen with menus and submenus, while on the loop() function, i’ve coded a while(true) loop that essentially “halts” the screen from refreshing itself constantly and expects input from touching the buttons (in an if condition). while i’m in that loop i cannot update the temperature and humidity display on a constant rate.
I’ve tried to use millis(); but it won’t work inside the while.
I’ve also tried using a button that refreshes the values for 60 seconds or any other time. This works, but it’s not an optimal solution.
What do you guys suggest?