| 123456789101112131415161718192021222324252627282930 |
- #include <Adafruit_AHTX0.h>
- Adafruit_AHTX0 aht;
- struct {
- public:
- float temperature;
- float humidity;
- } HumTemp;
- void initHumidity() {
- debugln("Initializing humidity sensor");
-
- if (!aht.begin()) {
- Serial.println("Could not initialize humidity sensor");
- // TODO: Turn on the LED or screen or something
- ERR;
- }
- debugln("Initialized humidity sensor");
- }
- void updateHumidity() {
- sensors_event_t hum,
- temp;
- aht.getEvent(&hum, &temp);
- HumTemp.temperature = temp.temperature;
- HumTemp.humidity = hum.relative_humidity;
- }
|