document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <dht11.h>
  2. dht11 DHT;
  3. #define DHT11_PIN 4
  4.  
  5. void setup(){
  6. Serial.begin(9600);
  7. Serial.println("DHT TEST PROGRAM ");
  8. Serial.print("LIBRARY VERSION: ");
  9. Serial.println(DHT11LIB_VERSION);
  10. Serial.println();
  11. Serial.println("Type,\\tstatus,\\tHumidity (%),\\tTemperature (C)");
  12. }
  13.  
  14. void loop(){
  15. int chk;
  16. Serial.print("DHT11, \\t");
  17. chk = DHT.read(DHT11_PIN); // READ DATA
  18. switch (chk){
  19. case DHTLIB_OK:
  20. Serial.print("OK,\\t");
  21. break;
  22. case DHTLIB_ERROR_CHECKSUM:
  23. Serial.print("Checksum error,\\t");
  24. break;
  25. case DHTLIB_ERROR_TIMEOUT:
  26. Serial.print("Time out error,\\t");
  27. break;
  28. default:
  29. Serial.print("Unknown error,\\t");
  30. break;
  31. }
  32. // DISPLAT DATA
  33. Serial.print(DHT.humidity,1);
  34. Serial.print(",\\t");
  35. Serial.println(DHT.temperature,1);
  36.  
  37. delay(1000);
  38. }
');