I have create a project that works with LCD display 1602 via i2c and monitor with Blynk Apps Also, so we have two display run at same time on blynk.
#define BLYNK_PRINT Serial
#include SPI.h>
#include Ethernet.h>
#include BlynkSimpleEthernet.h>
#include SimpleTimer.h>
#include Wire.h>
#include LiquidCrystal_I2C.h>
#include DHT.h>
char auth[] = "";
#define DHTPIN 2
LiquidCrystal_I2C lcd(0x27,16,2);
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;
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 setup()
{
lcd.init();
lcd.backlight();
dht.begin();
lcd.setCursor(0, 0);
lcd.print("Temp:");
lcd.setCursor(0, 1);
lcd.print("Humidity:");
Serial.begin(9600);
Blynk.begin(auth);
timer.setInterval(1000L, sendSensor);
}
void loop() {
delay(500);
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
lcd.print("ERROR");
return;
}
lcd.setCursor(5,0);
lcd.print(t);
lcd.setCursor(9,1);
lcd.print(h);
{
Blynk.run(); // Initiates Blynk
timer.run(); // Initiates SimpleTimer
}
}