Problems writing to Blynk lcd

Before creating the topic

  1. Search forum for similar topics
  2. Check http://docs.blynk.cc and http://help.blynk.cc/
  3. Add details :
    • Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
    • Using IOS
    • Blynk server or local server
    • Blynk Library version
    • Add your sketch code. :point_up:Code should be formatted as example below.

Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.

     lcd.clear(); //Use it to clear the LCD Widget
     lcd.print(4,0, tindata); // use: (position X: 0-15,
void loop()

I have a problem with the lcd widget not displaying correctly.
I am using a Wemos D32 Pro controller.

Hi there, the data I receive (tindata) is text “Temp. C: -”
The data is printed on the lcd screen, but not formatted.
What is displayed is a lower case p, 4 0 and then Temp etc., i.e. the formatting data first and then the data.

Please note that I have correctly inserted the lcd widget code before “void setup”.
I am receiving data on my Blynk app in the terminal widget correctly “same project”.

Any ideas, thanks,

Please post your full sketch.

Pete.

Hello Pete, herewith the sketch. I saw your comments about refreshing the lcd periodically. However, when I download the sketch to the device, this problem with the lcd is always the same, even if the data is sent within a few seconds of the program download.

//THE SERIAL DATA IS RECEIVED FROM A REMOTE SENSOR
//VIA 860MHZ TRANSMITTER
//HAVE LEFT OUT AUTHORISATION CODES AND WIFI LOGON DATA
//I HAVE ONE OR TWO ISSUES WITH CARRIAGE RETURNS TO BE SORTED
//OUT ON THE TERMINAL PROGRAM

//WD32 HAS A PROBLEM WITH SOFTWARE SERIAL
//#include <NewSoftSerial.h>  //problem
//NewSoftSerial mySerial(18, 19); //problem
#include <SPI.h>
#define BLYNK_PRINT Serial 
#define BLYNK_WRITE
#include <BlynkSimpleEsp32.h>
#include "WiFi.h"
#include <Wire.h>
#include "RTClib.h"
RTC_DS3231 rtc;
#include <HardwareSerial.h>
#include "SSD1306Ascii.h"
#include "SSD1306AsciiWire.h"
// 0X3C+SA0 - 0x3C or 0x3D
#define I2C_ADDRESS 0x3C
SSD1306AsciiWire oled;
//#include <SoftwareSerial.h>
//USE I/O PORTS 7 AND 8 FOR COMMS
//SoftwareSerial mySerial(7, 8); // RX, TX
#define RXD2 18
#define TXD2 19
String indata;  //STORES STARTUP HEX - discarded
String cvindata; //STORES CELL VOLTS
String bvindata; //STORES BATT VOLTS
String tindata;  //STORES TEMP. DEG C.
//int tindata1;
String pfindata; // STORES PULSE FREQUENCY
String kphindata;  //STORES WIND SPEED KPH
String gkphindata;  //STORES WIND SPEED GUST KPH
float cvindata1;  //convert to send to blynk
String datetime;
int cntdwn=30;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).



WidgetTerminal terminal(V7);
WidgetLCD lcd(V6);


BlynkTimer timer; //timer setup 

BLYNK_CONNECTED() { //RESTORES CONNECTION TO APP
    Blynk.syncAll();
}

void setup() {
// put your setup code here, to run once:
  Serial.begin(9600);
//START HARDWARE SERIAL
  Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
  Wire.begin();
  rtc.begin();
  timer.setInterval(1000L, pgmrun); //ROUTINE RUNS EVERY SECOND
  Blynk.begin(auth, ssid, password);
  Serial.println("Ver: 7/1/21 1.02");
  oled.begin(&Adafruit128x64, I2C_ADDRESS);
  oled.setFont(Adafruit5x7);
  oled.setFont(Adafruit5x7);
  uint32_t m = micros(); 
  oled.clear();
  oled.set1X();
 //oled.println("JW TEST 1");
 //Serial.println("JW TEST 2");
 // This line sets the RTC
 //rtc.adjust(DateTime(2021, 1, 19, 16, 39, 0));
}

void loop() {
    Blynk.run();
    timer.run();
}

void pgmrun(){
cntdwn--;
    if (Serial2.available()>0){
//BE CAREFUL! DATA MAY BE LEFT IN BUFFER
    //cvindata=(Serial2.readStringUntil('\n'));
    cvindata=(Serial2.readStringUntil('\n')); //store data til CR
    oled.clear();                     //CLEAR OLED DISPLAY
    oled.println(cvindata);           //WRITE TO OLED DISPLAY
    Serial.print(cvindata); //SEND TO DLOG, DO NOT INSERT CR HERE
    Blynk.virtualWrite(V7, cvindata); //SEND DATA TO BLYNK
    }
if (Serial2.available()>0){       //REPEAT UNTIL ALL DATA RCVD
    bvindata=(Serial2.readStringUntil('\n'));
    oled.println(bvindata);
    Serial.print(bvindata);
    Blynk.virtualWrite(V7, bvindata);
    }
    if (Serial2.available()>0){
    tindata=(Serial2.readStringUntil('\n'));
    oled.println(tindata);
    Serial.print(tindata);
    Blynk.virtualWrite(V7, tindata);
     lcd.clear(); //Use it to clear the LCD Widget
     lcd.print(0,0, tindata); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
    DateTime now = rtc.now();  
    oled.print(now.day(), DEC);
    oled.print("/");
    oled.print(now.month(), DEC);
    oled.print("/");
    oled.print(now.year(), DEC);
    oled.print(" ");
    oled.print(now.hour(), DEC);
    oled.print(":");
    oled.println(now.minute(), DEC);
    
    //SEND DATE AND TIME TO DATALOG FOR BATTERY DATA, TEMP DATA
    Serial.print(now.day(), DEC);
    Serial.print("/");
    Serial.print(now.month(), DEC);
    Serial.print("/");
    Serial.print(now.year(), DEC);
    Serial.print(" ");
    Serial.print(now.hour(), DEC);
    Serial.print(":");
    Serial.println(now.minute(), DEC);
    
    Blynk.virtualWrite(V7, now.day());
    Blynk.virtualWrite(V7, "/");
    Blynk.virtualWrite(V7, now.month());
    Blynk.virtualWrite(V7, "/");
    Blynk.virtualWrite(V7, now.year());
    Blynk.virtualWrite(V7, " ");
    Blynk.virtualWrite(V7, now.hour());
    Blynk.virtualWrite(V7, ":");
    Blynk.virtualWrite(V7, now.minute());
    terminal.println();
    }
if (Serial2.available()>0){
    pfindata=(Serial2.readStringUntil('\n'));
    oled.println(pfindata);
    Serial.println(pfindata);
    Blynk.virtualWrite(V7, pfindata);
}
if (Serial2.available()>0){
    kphindata=(Serial2.readStringUntil('\n'));
    oled.println(kphindata);
    Serial.println(kphindata);
    Blynk.virtualWrite(V7, kphindata);
}
if (Serial2.available()>0){
    gkphindata=(Serial2.readStringUntil('\n'));
    oled.println(gkphindata);
    Serial.println(tindata);
    Blynk.virtualWrite(V7, gkphindata);
 //SEND DATE AND TIME TO DLOG AFTER WIND DATA RECEIVED
 DateTime now = rtc.now();  //sends date to datalog after wind data
    Serial.print(now.day(), DEC);
    Serial.print("/");
    Serial.print(now.month(), DEC);
    Serial.print("/");
    Serial.print(now.year(), DEC);
    Serial.print(" ");
    Serial.print(now.hour(), DEC);
    Serial.print(":");
    Serial.println(now.minute(), DEC);
 }
if (cntdwn==0) {
   blrecon(); 
   }
Blynk.virtualWrite(V5, cntdwn);
}

void blrecon() {  //reconnect to blynk
Blynk.virtualWrite(V7, "Blynk Wifi Reset "); 
Blynk.begin(auth, ssid, password);  
cntdwn=3600;//APPROX ONE HOUR BETWEEN WIFI RESETS
}

@Jalpine please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

Hello Pete, thanks for the reply, hope this is edited correctly.

[Unformatted code removed by moderator]

Well, first of all, you didn’t edit your previous post (as I requested) you re-posted your code.

Secondly, despite me providing you with triple backticks to copy/paste you decided to use different characters, which just doesn’t work.

Please tidy-up the topic so that you end-up with ONE copy of the code which is CORRECTLY FORMATTED.

Pete.