SHARE
TWEET

DHT11, Nokia 5110, Arduino

Zoff76 Jan 24th, 2018 (edited) 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Nokia_5110.h"
  2.  
  3. #define RST 2
  4. #define CE 3
  5. #define DC 4
  6. #define DIN 5
  7. #define CLK 6
  8.  
  9. Nokia_5110 lcd = Nokia_5110(RST, CE, DC, DIN, CLK);
  10.  
  11. #include "DHT.h"
  12.  
  13. #define DHTPIN 8 //adatPIN
  14. #define DHTTYPE DHT11 //mérő típusa
  15.  
  16. DHT dht(DHTPIN, DHTTYPE);
  17.  
  18.  
  19. void setup() {
  20.     /**
  21.      * Note: if instead of text being shown on the display, all the segments are on, you may need to decrease contrast value.
  22.      */
  23.     lcd.setContrast(61); // 60 is the default value set by the driver
  24.    
  25.     lcd.print("Pillanat ...");
  26.     delay(1000);
  27.     lcd.clear();
  28.    
  29. }
  30.  
  31. void loop() {
  32.    delay(1000);
  33.    
  34.    float h = dht.readHumidity();
  35.    float t = dht.readTemperature();
  36.  
  37.    lcd.println("   Homerseklet: ");
  38.    lcd.print("        ");
  39.    lcd.print(t);
  40.    lcd.println(" C");
  41.    lcd.println("     ");
  42.    
  43.    lcd.println("  Paratartalom: ");
  44.    lcd.print("        ");
  45.    lcd.print(h);
  46.    lcd.println(" %");
  47.    lcd.setCursor(0, 0);
  48.  
  49.    delay(60000);
  50.    
  51.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top