Advertisement
Lukashk

Terarium

Mar 9th, 2020
2,267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Teploměr a vlhkoměr DHT11/22
  2. // odkomentování správného typu čidla
  3. //#define typDHT11 DHT11     // DHT 11
  4. #define typDHT22 DHT22   // DHT 22 (AM2302)
  5. #define DS3231_I2C_ADDRESS 0x68
  6. #define RELE1 5                                       // světlo 1                        // pin D5
  7. #define RELE2 4                                       // světlo 2                        // pin D4
  8. #define RELE3 3                                       // Hl.světlo                       // pin D3
  9. #define RELE4 2                                       // rosa                            // pin D2
  10.  
  11. LiquidCrystal_I2C lcd(0x27, 20, 4); // set the LCD address to 0x27 for a 20 chars and 4 line display
  12.  
  13. // inicializace DHT senzoru s nastaveným pinem a typem senzoru
  14. DHT mojeDHT(pinDHT, typDHT22);
  15.  
  16. ts t; //ts is a struct findable in ds3231.h
  17.  
  18.  
  19. void setup() {
  20.   Wire.begin(); //start i2c (required for connection)
  21.   // komunikace přes sériovou linku rychlostí 9600 baud
  22.   Serial.begin(9600);
  23.   // zapnutí komunikace s teploměrem DHT
  24.   mojeDHT.begin();
  25.   DS3231_init(DS3231_INTCN); //register the ds3231 (DS3231_INTCN is the default address of ds3231, this is set by macro for no performance loss)
  26.   pinMode(RELE1, OUTPUT);           // světlo 1  -> Zhasnuto = HIGH
  27.   pinMode(RELE2, OUTPUT);           // světlo 2  -> Zhasnuto = HIGH
  28.   pinMode(RELE3, OUTPUT);           // Hl.světlo -> Zhasnuto = HIGH
  29.   pinMode(RELE4, OUTPUT);           // rosa      -> Vypnuto  = HIGH
  30.  
  31.   lcd.init();
  32.   // Print a message to the LCD.
  33.   lcd.backlight();
  34.  
  35. }
  36.  
  37. void loop() {
  38.     spinani();
  39.     displayTime();
  40.     zobraz();
  41.     DHTTer();
  42.    
  43.      
  44.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement