Advertisement
Guest User

Untitled

a guest
Nov 8th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <LiquidCrystal_I2C.h>
  2. #include <dht11.h>
  3. #include <Wire.h>
  4.  
  5.  
  6. dht11 DHT11;
  7. #define DHT11PIN 8
  8. int AmpelRot = 9;
  9. int AmpelGelb = 10;
  10. int AmpelGruen = 11;
  11. int RelF = 56;
  12.  
  13.  
  14.  
  15. LiquidCrystal_I2C lcd(0x27, 16, 2);
  16.  
  17. void setup() {
  18.  
  19.  
  20.   lcd.begin();
  21.   lcd.print("Initialisierung...");
  22.  
  23.   lcd.clear();
  24.  
  25.   pinMode(9,OUTPUT);
  26.   pinMode(10,OUTPUT);
  27.   pinMode(11,OUTPUT);
  28.  
  29.  
  30.  
  31. }
  32.  
  33. void loop() {
  34.  
  35.  
  36. int chk = DHT11.read(DHT11PIN);
  37.  
  38. /*AMPEL*/
  39.   /*Ampel ROT*/
  40.    if (RelF > 74.5 && RelF < 100.00 )
  41.       {
  42.         digitalWrite(AmpelGruen,LOW);
  43.         digitalWrite(AmpelGelb,LOW);
  44.         digitalWrite(AmpelRot,HIGH);
  45.  
  46.       }
  47.    
  48.   /*Ampel GELB*/    
  49.    if (RelF < 74.5 && RelF > 54.5 )
  50.       {
  51.         digitalWrite(AmpelGruen,LOW);
  52.         digitalWrite(AmpelGelb,HIGH);
  53.         digitalWrite(AmpelRot,LOW);
  54.       }  
  55.   /*Ampel GRÃœN*/
  56.   if ( RelF >= 9.5 && RelF <= 45.5 )
  57.       {
  58.         digitalWrite(AmpelGruen,HIGH);
  59.         digitalWrite(AmpelGelb,LOW);
  60.         digitalWrite(AmpelRot,LOW);
  61.       }
  62.  
  63. /*LCD*/
  64.   lcd.setCursor(0, 0);
  65.   lcd.print("Temp: ");
  66.   lcd.print((float)DHT11.temperature, 2);
  67.   lcd.print(" C");
  68.  
  69.   lcd.setCursor(0, 1);
  70.   lcd.print("RelF: ");
  71.   lcd.print((float)DHT11.humidity, 2);
  72.   lcd.print(" %");
  73.  
  74.   delay(500);
  75.  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement