Start a new topic

Help with ESP8266 and Nextion

Hi, I have a ESP8266-07 that want to connect a lcd Nextion. Is possible to use SoftwareSerial library to simulate a new serial port using GPIO5 and GPIO4 pins? I tried to use a simple example and does not work ...

  

#include <SoftwareSerial.h>

SoftwareSerial Nextion(4, 5); // RX, TX

void setup() {
Nextion.begin(9600);

const char *t0h = "t0.txt=\"";
byte ter[4] = {0x22, 0xff, 0xff, 0xff};//0x22 is the double quote to end the text content.

Nextion.print(t0h);
Nextion.print("my message");
Nextion.write(ter, 4);
}

  What am I doing wrong?

Thank you!


it is incorrect to do the ter[4].

If it works because you are shortcutting a literal double-quote

 - it surely will byte you later.


indev2's example was fairly clear

  byte ter[3] = {0xff, 0xff, 0xff};

Maybe my problem is elsewhere ...On display, there is only one page (page0) and a textbox t0.

I tried this version:  

const char *t0h = "t0.txt=\"";
byte ter[3] = {0xff, 0xff, 0xff};

Nextion.print(t0h);
Nextion.print("xxx");
Nextion.print("\"");
Nextion.write(ter, 3); 

  and this one:  

const char *t0h = "t0.txt=";
byte ter[3] = {0xff, 0xff, 0xff};

Nextion.print(t0h);
Nextion.print("xxx");
Nextion.write(ter, 3);

 but it did not work either ...

If I connect a serial port monitor on ESP8266 software serial, I receive the following answer: t0.txt = "mytext" yyy (or without double quota in first case), so I assume that the module transmits data correctly.

My mistake ... font color and background color was black. So everything works normal! Please excuse me...

how about

 

Nextion.print("t0.txt=\"Hello!\"");
Nextion.write(ter, 3);

 


The result is

Login or Signup to post a comment