Files
IoTManager/src/items/SensorDhtClass.cpp

33 lines
1.1 KiB
C++
Raw Normal View History

2020-09-04 13:44:49 +03:00
#include "items/SensorDhtClass.h"
2020-09-04 15:35:35 +03:00
2020-09-04 18:58:03 +03:00
#include "ItemsCmd.h"
2020-09-04 13:44:49 +03:00
//#ifdef SensorDhtEnabled
2020-09-04 15:35:35 +03:00
//=========================================DHT Sensor==================================================================
//dht-temp;id;anydata;Сенсоры;Температура;order;pin;type[dht11];c[1]
//dht-hum;id;anydata;Сенсоры;Влажность;order;pin;type[dht11];c[1]
2020-09-04 13:44:49 +03:00
//=========================================================================================================================================
SensorDhtClass mySensorDht;
2020-09-04 15:35:35 +03:00
void dhtTemp() {
2020-09-04 13:44:49 +03:00
mySensorDht.update();
String key = mySensorDht.gkey();
2020-09-04 15:35:35 +03:00
sCmd.addCommand(key.c_str(), dhtReadingTemp);
2020-09-04 13:44:49 +03:00
mySensorDht.SensorDhtInit();
mySensorDht.clear();
}
2020-09-04 15:35:35 +03:00
void dhtReadingTemp() {
String key = sCmd.order();
mySensorDht.SensorDhtReadTemp(key);
}
2020-09-04 13:44:49 +03:00
2020-09-04 15:35:35 +03:00
void dhtHum() {
mySensorDht.update();
String key = mySensorDht.gkey();
sCmd.addCommand(key.c_str(), dhtReadingHum);
mySensorDht.SensorDhtInit();
mySensorDht.clear();
}
void dhtReadingHum() {
2020-09-04 13:44:49 +03:00
String key = sCmd.order();
2020-09-04 15:35:35 +03:00
mySensorDht.SensorDhtReadHum(key);
2020-09-04 13:44:49 +03:00
}
//#endif