I would like the code not to exit if the reading is not received or it is in wrong format. I just want to disregard it. I do readings pretty often, so missing one cycle is not a problem at all. Bigger problem is that the whole process is down that might have bad result. I am using it in small in house greenhouse with LED grow lights and have temperature control using PC fans. So if the code exits and LED lamps are on, there is a risk that temperature will go too high, something I need to avoid.
I use command "sensor.measure()" to read from DHT22 sensor. And I use following code for DS1820:
Code: Select all
roms = ds.scan() print('found devices:', roms) addr = roms.pop() ds.convert_temp() temp = ds.read_temp(addr)
Also, is there any way to write log into the file on ESP32? something that would tell me what line of the code it crashed, so that I can hopefully address it?