Added AM2302 sensor reading to one of the screens
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#ifndef AM2302_SENSOR_H
|
||||
#define AM2302_SENSOR_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
struct Am2302Reading
|
||||
{
|
||||
float temperatureC;
|
||||
float humidityPercent;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
class Am2302Sensor
|
||||
{
|
||||
public:
|
||||
explicit Am2302Sensor(uint8_t pin);
|
||||
|
||||
void begin();
|
||||
bool update(unsigned long now);
|
||||
Am2302Reading reading() const;
|
||||
|
||||
private:
|
||||
uint8_t pin_;
|
||||
unsigned long nextRead_;
|
||||
Am2302Reading reading_;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user