#include "thingProperties.h"
#include "DHT.h"
#include <LiquidCrystal_I2C.h>
DHT dht(0, DHT22);
LiquidCrystal_I2C LCD = LiquidCrystal_I2C(0x27, 16, 2);
void setup() {
Serial.begin(9600);
delay(1000);
// pin mode
pinMode(12, OUTPUT);
// lcd başlatma
LCD.init();
LCD.backlight();
LCD.setCursor(0, 0);
// arduino cloud kodları
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
//Serial.println("Hello, ESP32!");
}
void loop() {
ArduinoCloud.update();
dhtVeriOkuma();
//Serial.println(sicaklik);
delay(2000);
}
void dhtVeriOkuma(){
float t = dht.readTemperature();
float u = dht.readHumidity();
Serial.println('Sıcaklık: '+ String(t));
Serial.println('Nem: '+ String(u));
sicaklik = t;
nem = u;
delay(5000);
}
void onMesajChange() {
LCD.clear();
LCD.setCursor(0, 0);
LCD.print(mesaj);
// Add your code here to act upon Mesaj change
}
/*
Since Led is READ_WRITE variable, onLedChange() is
executed every time a new value is received from IoT Cloud.
*/
void onLedChange() {
if (led == 1)
{
digitalWrite(12, HIGH);
}
else
{
digitalWrite(12, LOW);
}
// Add your code here to act upon Led change
}