Using two sensors, want to read every second from one, but only every minute for the other. How can I do this?
Posted: Sun Sep 17, 2023 8:06 pm
Sorry for the long title.
I have two sensors, a BH1750 light sensor and DHT11 temperature and humidity sensor running on an esp32 (wroom32). I want to read from the light sensor every second, but I only want to read from the DHT11 every minute. The methods for reading the sensors are separate. I can add a delay(1000) for the light sensor's method, but how can I delay reading from the DHT11 for one minute? I'm new to the platform, but I've looked around the 'net and can't find any similar situations. I also considered interrupts, but that seems impractical as I'm sure reading from sensors involves interrupts, which would make that problematic. So, is this even possible? If so, how do I go about it?
Thanks
I have two sensors, a BH1750 light sensor and DHT11 temperature and humidity sensor running on an esp32 (wroom32). I want to read from the light sensor every second, but I only want to read from the DHT11 every minute. The methods for reading the sensors are separate. I can add a delay(1000) for the light sensor's method, but how can I delay reading from the DHT11 for one minute? I'm new to the platform, but I've looked around the 'net and can't find any similar situations. I also considered interrupts, but that seems impractical as I'm sure reading from sensors involves interrupts, which would make that problematic. So, is this even possible? If so, how do I go about it?
Thanks