Created
May 31, 2014 19:47
-
-
Save nazrdogan/cb9bd8a1f52d50d14106 to your computer and use it in GitHub Desktop.
Arduino Sıcaklık ve Nem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <dht.h> | |
dht DHT; | |
#define DHT11_PIN 5 | |
void setup() | |
{ | |
Serial.begin(115200); | |
// Serial.println("DHT TEST PROGRAM "); | |
//Serial.print("LIBRARY VERSION: "); | |
//Serial.println(DHT_LIB_VERSION); | |
// Serial.println(); | |
// Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)"); | |
} | |
void loop() | |
{ | |
// READ DATA | |
//Serial.print("DHT11, \t"); | |
int chk = DHT.read11(DHT11_PIN); | |
switch (chk) | |
{ | |
case DHTLIB_OK: | |
// Serial.print("OK,\t"); | |
break; | |
case DHTLIB_ERROR_CHECKSUM: | |
Serial.print("Checksum error,\t"); | |
break; | |
case DHTLIB_ERROR_TIMEOUT: | |
Serial.print("Time out error,\t"); | |
break; | |
default: | |
Serial.print("Unknown error,\t"); | |
break; | |
} | |
// DISPLAY DATA | |
Serial.print(DHT.humidity, 1); | |
Serial.print(","); | |
Serial.println(DHT.temperature, 1); | |
delay(2000); | |
} | |
// | |
// END OF FILE | |
// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment