Example Testing Sketch For Various DHT Humidity
Example Testing Sketch For Various DHT Humidity
#include "DHT.h"
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
// Note that older versions of this library took an optional third parameter to
// tweak the timings for faster processors. This parameter is no longer needed
// as the current DHT reading algorithm adjusts itself to work on faster procs.
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
delay(1000);
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
// Check if any reads failed and exit early (to try again).
return;
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
if (t < 75){
Serial.println(" =lembab");
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
Serial.println(" =normal");
else if (t >85) {
Serial.println(" =kering");
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" *C ");
//Serial.print(f);//
//Serial.println(" *F\t");
//Serial.print(hic);//
//Serial.print(" *C ");//
//Serial.print(hif);//
//Serial.println(" *F");//
if (t < 25){
Serial.println(" =dingin");
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
Serial.println(" =sedang");
else if (t >35) {
Serial.println(" =panas");
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);