From 048ba68238d018091998441354d175a569a66aaa Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Sat, 13 Jul 2024 20:44:01 +0200 Subject: [PATCH] some code improvements Signed-off-by: Stephan Richter --- Taupunkt/Taupunkt.ino | 58 +++++++------------------------------------ 1 file changed, 9 insertions(+), 49 deletions(-) diff --git a/Taupunkt/Taupunkt.ino b/Taupunkt/Taupunkt.ino index 7ad9117..5a46527 100644 --- a/Taupunkt/Taupunkt.ino +++ b/Taupunkt/Taupunkt.ino @@ -1,65 +1,23 @@ -/* - LiquidCrystal Library - Hello World - - Demonstrates the use a 16x2 LCD display. The LiquidCrystal - library works with all LCD displays that are compatible with the - Hitachi HD44780 driver. There are many of them out there, and you - can usually tell them by the 16-pin interface. - - This sketch prints "Hello World!" to the LCD - and shows the time. - - The circuit: - * LCD RS pin to digital pin 12 - * LCD Enable pin to digital pin 11 - * LCD D4 pin to digital pin 5 - * LCD D5 pin to digital pin 4 - * LCD D6 pin to digital pin 3 - * LCD D7 pin to digital pin 2 - * LCD R/W pin to ground - * LCD VSS pin to ground - * LCD VCC pin to 5V - * 10K resistor: - * ends to +5V and ground - * wiper to LCD VO pin (pin 3) - - Library originally added 18 Apr 2008 - by David A. Mellis - library modified 5 Jul 2009 - by Limor Fried (http://www.ladyada.net) - example added 9 Jul 2009 - by Tom Igoe - modified 22 Nov 2010 - by Tom Igoe - modified 7 Nov 2016 - by Arturo Guadalupi - - This example code is in the public domain. - - http://www.arduino.cc/en/Tutorial/LiquidCrystalHelloWorld - -*/ - // include the library code: #include #include -int pinDHT22a = 8; +int pinDHT22a = 7; DHT22 dht22a(pinDHT22a); int status1 = 0; -int pinDHT22b = 9; +int pinDHT22b = 6; DHT22 dht22b(pinDHT22b); int status2 = 0; -const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; +const int rs = 13, en = 12, d4 = 11, d5 = 10, d6 = 9, d7 = 8; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); float temp1 = 0, temp2 = 0, humi1 = 0, humi2 = 0; -float treshold = 5.0; -float hyster = 1.0; +float treshold = 2; +float hyster = 1; float min_temp = 5; -int relay = 7; +int relay = 5; byte degree[8] = { 0b00010, @@ -114,6 +72,8 @@ void setup() { lcd.createChar(2, on); lcd.createChar(3, off); pinMode(relay,OUTPUT); + pinMode(4,OUTPUT); + digitalWrite(4,LOW); lcd.setCursor(0,0); lcd.print(" IN OUT"); @@ -168,7 +128,7 @@ float taupunkt(float t, float r) { if (t >= 0) { a = 7.5; b = 237.3; - } else if (t < 0) { + } else { a = 7.6; b = 240.7; }