Tutorial Monitoring Suhu dan Kelembapan Udara berbasis Arduino Nano R3

Berikut adalah Tutorial Monitoring Suhu dan Kelembapan Udara berbasis Arduino Nano R3

Ini adalah sketch program arduino

/*
11_DHT11 Monitoring Suhu Kelembapan Bluetooth
*/

#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>

#define DHTPIN 2
#define DHTTYPE    DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup()
{
Serial.begin(9600);
dht.begin();
}

void loop()
{
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t))
{
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
Serial.print(F("Humidity: "));
Serial.print(h);
Serial.print(F("%  Temperature: "));
Serial.print(t);
Serial.println(F("°C "));
}

Leave a Reply

Your email address will not be published. Required fields are marked *