switched back to DHT22
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#define ID 0
|
#define ID 0
|
||||||
#define PROGRAM "TempSender"
|
#define PROGRAM "TempSender"
|
||||||
#define SW_VERSION "1.4"
|
define SW_VERSION "1.5"
|
||||||
#define HW_VERSION "2.0"
|
#define HW_VERSION "2.0"
|
||||||
|
|
||||||
#define BTN_INT 2 // button interrupt pin
|
#define BTN_INT 2 // button interrupt pin
|
||||||
@@ -41,15 +41,15 @@
|
|||||||
//#define LOG_TO_SERIAL
|
//#define LOG_TO_SERIAL
|
||||||
#define SEND_485
|
#define SEND_485
|
||||||
|
|
||||||
SimpleDHT11 sensor(DHT_PIN);
|
SimpleDHT22 sensor(DHT_PIN);
|
||||||
|
|
||||||
boolean raw_states[8];
|
boolean raw_states[8];
|
||||||
boolean states[8];
|
boolean states[8];
|
||||||
unsigned long capacitor[8];
|
unsigned long capacitor[8];
|
||||||
unsigned long times[8];
|
unsigned long times[8];
|
||||||
unsigned long sensor_time = 0;
|
unsigned long sensor_time = 0;
|
||||||
byte temperature = 0;
|
float temperature = 0;
|
||||||
byte humidity = 0;
|
float humidity = 0;
|
||||||
int err = SimpleDHTErrSuccess;
|
int err = SimpleDHTErrSuccess;
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
@@ -134,8 +134,8 @@ void loop(){
|
|||||||
|
|
||||||
if (now - sensor_time > PERIOD){
|
if (now - sensor_time > PERIOD){
|
||||||
sensor_time = now;
|
sensor_time = now;
|
||||||
if ((err = sensor.read(&temperature, &humidity, NULL)) == SimpleDHTErrSuccess) {
|
if ((err = sensor.read2(&temperature, &humidity, NULL)) == SimpleDHTErrSuccess) {
|
||||||
String s = "{nano:"+String(ID)+",temp:"+String((int)temperature)+",humi:"+String((int)humidity)+"}";
|
String s = "{nano:"+String(ID)+",temp:"+String(temperature,1)+",humi:"+String(humidity,1)+"}";
|
||||||
send485(s.c_str());
|
send485(s.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user