Sry for my english, btw i have project here name “Temperature Monitoring with Blynk + LCD I2C” , The issues is my LCD didnt work properly i mean theres no word in it. Thanks for your time
Details :
MCU : Arduino Uno
Wifi Module : esp8266-01
Sensor : DHT-22
LCD : LCD 16x2 I2C
CODE = ----------------------------------------------------------------------------------------------------------------
#define BLYNK_TEMPLATE_ID "****************************"
#define BLYNK_DEVICE_NAME "****************************"
#define BLYNK_AUTH_TOKEN "****************************"
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <DHT.h>
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
char auth[] = "****************************";
char ssid[] = "****************************";
char pass[] = "****************************";
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX
#define ESP8266_BAUD 9600// Your ESP8266 baud rate:
ESP8266 wifi(&EspSerial);
BlynkTimer timer;
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define DHTPIN 4 // What digital pin we're connected to
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
timer.setInterval(1000L, sendSensor);
lcd.begin();
lcd.backlight();
dht.begin();
}
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Blynk.virtualWrite(V5, h);
Blynk.virtualWrite(V6, t);
}
void loop(){
float h = dht.readHumidity();
float t = dht.readTemperature();
lcd.setCursor(0, 0);
lcd.print("H : ");
lcd.print(h);
lcd.print("%");
lcd.setCursor(0, 1);
lcd.print("T : ");
lcd.print(t);
lcd.print("C");
Blynk.run();
timer.run();
}