Arduino,Mengakses sensor dht11,suhu dan kelembaban Assalamualaikum….
Selamat malam kawan-kawan Anak Kendali dimanapun berada,
hehe…kali ini kita akan mencoba mengakses sensor suhu dan kelembaban,
disini kita pakai dht11,ok langsung ke TKP.

Keyword : Cara mengakses sensor dht11,suhu dan kelembaban,Arduino pemula

Bahan :

  1. Arduino

Wiringnya :

Kode :

#include <SimpleDHT.h>

int pinDHT11 = 7;
SimpleDHT11 dht11;

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

void loop() {
Serial.println(“=================================”);
Serial.println(“Contoh DHT11…”);

byte temperature = 0;
byte humidity = 0;
int err = SimpleDHTErrSuccess;
if ((err = dht11.read(pinDHT11, &temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
Serial.print(“Error saat membaca dht11, err=”); Serial.println(err);delay(1000);
return;
}
Serial.print((int)temperature); Serial.print(“ *C, “);
Serial.print((int)humidity); Serial.println(“ H”);
delay(1000);
}

Ok,sekian dari saya,tunggu tutorial selanjutnya ya,
Wassalamualaikum.. sumber : https://www.anakkendali.com

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store