Skip to content

Instantly share code, notes, and snippets.

@nazrdogan
Created May 31, 2014 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nazrdogan/cb9bd8a1f52d50d14106 to your computer and use it in GitHub Desktop.
Save nazrdogan/cb9bd8a1f52d50d14106 to your computer and use it in GitHub Desktop.
Arduino Sıcaklık ve Nem
#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