minor improvements
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -3,9 +3,10 @@
|
||||
// load library for DHT22 sensor
|
||||
#include <DHT22.h>
|
||||
|
||||
#define TRESHOLD 2
|
||||
#define TRESHOLD 1
|
||||
#define HYSTERESIS 1
|
||||
#define MIN_OUT_TEMP 5 // °C
|
||||
#define ALLOWED_HUMIDITY 50 // %
|
||||
|
||||
#define RELAY_PIN 5
|
||||
|
||||
@@ -79,16 +80,8 @@ byte off[8] = {
|
||||
0b11111
|
||||
};
|
||||
|
||||
|
||||
void setup() {
|
||||
// set up the LCD
|
||||
lcd.begin(16, 4);
|
||||
lcd.createChar(0, degree);
|
||||
lcd.createChar(1, tau);
|
||||
lcd.createChar(2, on);
|
||||
lcd.createChar(3, off);
|
||||
|
||||
// prepare "table" on LCD
|
||||
void table(){
|
||||
// prepare "table" on LCD
|
||||
lcd.setCursor(0,0);
|
||||
lcd.print(" IN OUT");
|
||||
|
||||
@@ -106,7 +99,17 @@ void setup() {
|
||||
lcd.print(" . . ");
|
||||
lcd.write((int)0);
|
||||
lcd.print("C");
|
||||
}
|
||||
|
||||
void setup() {
|
||||
// set up the LCD
|
||||
lcd.begin(16, 4);
|
||||
lcd.createChar(0, degree);
|
||||
lcd.createChar(1, tau);
|
||||
lcd.createChar(2, on);
|
||||
lcd.createChar(3, off);
|
||||
|
||||
table();
|
||||
|
||||
// set up the relay
|
||||
pinMode(RELAY_PIN,OUTPUT);
|
||||
@@ -177,6 +180,8 @@ void loop() {
|
||||
outside_temp = dht22outside.getTemperature();
|
||||
outside_humi = dht22outside.getHumidity();
|
||||
outside_state = dht22outside.getLastError();
|
||||
int secs = millis()/1000;
|
||||
if (secs % 3600 < 3) table();
|
||||
|
||||
boolean inside_error = false, outside_error = false;
|
||||
|
||||
@@ -244,7 +249,7 @@ void loop() {
|
||||
if (inside_error || outside_error || outside_temp < MIN_OUT_TEMP){
|
||||
relayOff();
|
||||
} else {
|
||||
if (tau_inside > tau_outside + TRESHOLD + HYSTERESIS) {
|
||||
if (inside_humi > ALLOWED_HUMIDITY && tau_inside > tau_outside + TRESHOLD + HYSTERESIS) {
|
||||
relayOn();
|
||||
}
|
||||
if (tau_inside < tau_outside + TRESHOLD) {
|
||||
|
||||
Reference in New Issue
Block a user