Greetings:
I’m new to blynk currently i’m working on a project with Arduino Uno, I used Esp 01 to connect the Arduino to internet.
I want to display the results on both I2C lcd and lcd widget, but it doesn’t work for some reason , .
I get connected to Blynk server and a led (on, off) so the ESP is working correctly, then tried to print in lcd widget and it worked ( i got the print on the app) and tried the I2C LCD that i have and it’s working as well.
The problem is when combined both LCD and lcd widget I got the first print on LCD and the widget doesn’t print anything!! And the ESP stay connected to blynk server for seconds (`in blynk app shows that your device is offline).
I couldn’t find out the reason for this conflict, I tried to find which command the conflict starting with, so I deleted every command required for LCD to work then added them one by one, turns out it’s the command to declare the address for LCD.
LiquidCrystal_I2C lcd (0x27, 16, 2).
This is the code
// See the Device Info tab, or Template settings
#define BLYNK_TEMPLATE_ID "TEMPLATE_ID "
#define BLYNK_DEVICE_NAME "DEVICE_NAME "
#define BLYNK_AUTH_TOKEN "AUTH_TOKEN "
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "network_ssid";
char pass[] = "password";
// Hardware Serial on Mega, Leonardo, Micro...
//#define EspSerial Serial1
char dat[] = "hello";
// or Software Serial on Uno, Nano...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Your ESP8266 baud rate:
#define ESP8266_BAUD 38400
ESP8266 wifi(&EspSerial);
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V5, dat);//millis() / 1000
Blynk.virtualWrite(V0, 58.9); //random to test on blynk app
lcd.print("test");
}
void setup()
{
// Debug console
Serial.begin(115200);
lcd.begin();
lcd.backlight();
lcd.clear();
lcd.print("test1");
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
// Setup a function to be called every second
timer.setInterval(1000L, myTimerEvent);
}
void loop()
{
Blynk.run();
timer.run(); // Initiates BlynkTimer
}
and the connection as shown below:
I appreciate any ideas best regards.