Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <LiquidCrystal_I2C.h>
- #include <dht.h>
- LiquidCrystal_I2C lcd(0x27, 27 , 28); // Ustawienie adresu ukladu na 0x27
- dht DHT;
- #define DHT11_PIN 7
- const byte interruptPinINC = 2;
- const byte interruptPinDEC = 3;
- void setup()
- {
- pinMode(8, OUTPUT);
- lcd.init();
- lcd.begin(16, 2);
- lcd.backlight(); // zalaczenie podwietlenia
- lcd.setCursor(0, 0);
- digitalWrite(8, LOW);
- pinMode(interruptPinINC, INPUT_PULLUP);
- attachInterrupt(digitalPinToInterrupt(interruptPinINC), increase, FALLING);
- pinMode(interruptPinDEC, INPUT_PULLUP);
- attachInterrupt(digitalPinToInterrupt(interruptPinDEC), decrease, FALLING);
- }
- volatile double given = 50;
- void loop(){
- lcd.setCursor(0, 0);
- int chk = DHT.read11(DHT11_PIN);
- lcd.print("temp. ");
- lcd.print(DHT.temperature);
- lcd.print((char)223);
- lcd.print("C");
- lcd.setCursor(0, 1);
- lcd.print("zada. ");
- lcd.print(given);
- lcd.print((char)223);
- lcd.print("C");
- if (DHT.temperature >= given) {
- digitalWrite(8, LOW);
- } else {
- digitalWrite(8, HIGH);
- }
- delay(600);
- }
- void increase(){
- given++ ;
- }
- void decrease(){
- given-- ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement