[c] s
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- #include <Wire.h>
- #include <LiquidCrystal_I2C.h>
- #include "DHT.h"
- LiquidCrystal_I2C lcd(0x27, 16, 2);
- byte derajat[8] = {B00110,B01001,B01001,B00110,B00000,B00000,B00000,B00000};
- #define DHTPIN 2
- #define DHTTYPE DHT11
- DHT dht(DHTPIN, DHTTYPE);
- void setup() {
- Serial.begin(9600);
- lcd.begin();
- lcd.createChar(0, derajat);
- lcd.setCursor(0,0);
- lcd.print("Sensor DHT11");
- dht.begin();
- pinMode(4, OUTPUT);}
- void loop() {
- lcd.clear();
- float kelembaban = dht.readHumidity();
- float suhu = dht.readTemperature();
- Serial.print(" Suhu: ");
- Serial.print(suhu);
- Serial.print(" Kelembaban: ");
- Serial.println(kelembaban);
- lcd.setCursor(0,0);
- lcd.print("Temp : ");
- lcd.print(suhu);
- lcd.print(" ");
- lcd.write(byte(0));
- lcd.print("C");
- if (suhu >= 27) {
- lcd.setCursor(0,1);
- lcd.print("Suhu Panas");
- tone(4,500); }
- if (suhu < 27) {
- lcd.setCursor(0,1);
- lcd.print("Suhu Normal");}
- delay(1000);
- }
Editor
You can edit this paste and save as new: