Files
embedded-labs/include/drivers/DHTController.h
2025-04-28 18:30:29 +03:00

27 lines
542 B
C++

#ifndef DHT_CONTROLLER_H
#define DHT_CONTROLLER_H
#include <Arduino.h>
#include <DHT.h>
class DHTController {
private:
DHT _dht;
unsigned long _lastReadTime;
unsigned long _minReadInterval;
float _lastTemperature;
float _lastHumidity;
bool _lastReadSuccess;
public:
DHTController(uint8_t pin, uint8_t type = DHT11);
void begin();
bool read();
float getTemperature();
float getHumidity();
bool isLastReadSuccessful() const;
void setMinReadInterval(unsigned long interval);
};
#endif