SHARE
TWEET

DHT11 olvasása Arduinoval

Zoff76 Jan 24th, 2018 (edited) 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // DHT11 kiolvasása hibakód olvasás nélkül
  2.  
  3. #include "DHT.h"
  4.  
  5. #define DHTPIN 2 //adatPIN
  6. #define DHTTYPE DHT11 //mérő típusa
  7.  
  8. DHT dht(DHTPIN, DHTTYPE);
  9.  
  10. void setup() {
  11.  
  12.   Serial.begin(9600);
  13.   Serial.println("DHT11 test!");
  14.  
  15.   dht.begin();
  16. }
  17.  
  18. void loop() {
  19.  
  20.   delay(2000);
  21.  
  22.   float h = dht.readHumidity();
  23.   float t = dht.readTemperature();
  24.  
  25.   Serial.print("Paratartalom: ");
  26.   Serial.print(h);
  27.   Serial.println(" %\t");
  28.   Serial.print("Homerseklet: ");
  29.   Serial.print(t);
  30.   Serial.println(" *C ");
  31.   Serial.println(" ");
  32.  
  33. }
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
 
Top