Browse Source

some code improvements

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
main
Stephan Richter 4 months ago
parent
commit
048ba68238
  1. 58
      Taupunkt/Taupunkt.ino

58
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 the library code:
#include <LiquidCrystal.h> #include <LiquidCrystal.h>
#include <DHT22.h> #include <DHT22.h>
int pinDHT22a = 8; int pinDHT22a = 7;
DHT22 dht22a(pinDHT22a); DHT22 dht22a(pinDHT22a);
int status1 = 0; int status1 = 0;
int pinDHT22b = 9; int pinDHT22b = 6;
DHT22 dht22b(pinDHT22b); DHT22 dht22b(pinDHT22b);
int status2 = 0; 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); LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
float temp1 = 0, temp2 = 0, humi1 = 0, humi2 = 0; float temp1 = 0, temp2 = 0, humi1 = 0, humi2 = 0;
float treshold = 5.0; float treshold = 2;
float hyster = 1.0; float hyster = 1;
float min_temp = 5; float min_temp = 5;
int relay = 7; int relay = 5;
byte degree[8] = { byte degree[8] = {
0b00010, 0b00010,
@ -114,6 +72,8 @@ void setup() {
lcd.createChar(2, on); lcd.createChar(2, on);
lcd.createChar(3, off); lcd.createChar(3, off);
pinMode(relay,OUTPUT); pinMode(relay,OUTPUT);
pinMode(4,OUTPUT);
digitalWrite(4,LOW);
lcd.setCursor(0,0); lcd.setCursor(0,0);
lcd.print(" IN OUT"); lcd.print(" IN OUT");
@ -168,7 +128,7 @@ float taupunkt(float t, float r) {
if (t >= 0) { if (t >= 0) {
a = 7.5; a = 7.5;
b = 237.3; b = 237.3;
} else if (t < 0) { } else {
a = 7.6; a = 7.6;
b = 240.7; b = 240.7;
} }

Loading…
Cancel
Save