Indeed. In my thermometer project (which uses a giant 7-segment LED display, but also has a web server), the loop does the following:
- reads and filters the temperature
- converts to Fahrenheit if necessary
- formats the temperature for the LED display (my thermometer uses per-segment grayscale control, to mimic incandescent filament behavior, so the formatting code is much more complex than usual)
- formats the temperature string for the web server
- updates the display
Meanwhile, the async web server waits until a request comes in, and services it as needed.
Similarly, an interrupt is used to read the physical button (used for switching °C/F and adjusting display brightness).
(Actually, I use a library called TaskManagerIO to schedule the loop tasks at different intervals, so that it’s not trying to read the sensor a million times a second. Before reading the temperature, which does take a noticeable fraction of a second to complete on the DS18B20), I also make sure that the display code isn’t in the middle of updating the display, since a mid-update read causes the fading effect to stutter.)