How to test the Nextion 7" with arduino on esp32 devkit

I have an esp32 and Nextion 7" connected. Connection is OK. (I can run HMI editor and it send commands to Nextion 7")
I send simple commands to Nextion from esp32 and get no respond.

need HELP a simple code on arduing to send a Nextion command to print "Hello word" and draw line.
And second command to get back receive from Nextion the confirmation text "Commands correct" or "command error".
my code.
#include "Nextion.h"
#include "EEPROM.h"
// #include "HardwareSerial.h"

String endChar;

void setup() {
Serial.begin(115200);
Serial2.begin(9600,SERIAL_8N1,02,04);
Serial.println("Loopback program started");

endChar= "\xFF\xFF\xFF";

Serial2.print("sys0="+String(0)); 
Serial2.write(0xff);
Serial2.write(0xff);
Serial2.write(0xff);

delay(2000);
}

void loop()
{
int i, b;

Serial2.print("page 0"); 
Serial2.write(0xff);
Serial2.write(0xff);
Serial2.write(0xff);
delay(5);

String sendThis = ""; //Declare and initialise the string we will send
sendThis = "t1.txt=\"Test\""; //Build the part of the string that we know
Serial2.print(sendThis); // gives you an error due to a datatype mismatch*/
Serial2.print("Test");  
Serial2.write(0xff);  Serial2.write(0xff); Serial2.write(0xff);
delay(5); 

Serial2.print("Test");  
Serial2.write(0xff); Serial2.write(0xff); Serial2.write(0xff);
delay(5); 

for ( i=0; i<100; i++) {
b=i*10;

Serial2.print("line 20,37,270,300,BLUE");
Serial2.write(0xff); Serial2.write(0xff); Serial2.write(0xff);
delay(5);
Serial2.print("t1.txt="Test"");
Serial2.write(0xff); Serial2.write(0xff); Serial2.write(0xff);
Serial.print("Serial-Done="+String(i)+"\r\n"); // this to monitor what is send

delay (1000);
}

What level shifter on the ESP RX line are you using?

Non,
I'm connecting directly the Rx/TX from esp32 to Tx/Rx Nextion 7"
Thank you Whandall Karma:. This may be the problem? as esp32 is 3.3 v .
I measured the Tx and it is 3.04v
You think this is the problem?
I need to make the ttl 3.3v shifted to ttl 5v for proper connection.
What module/chip you will recommend?
p.s I do use direct connections on my other ttl 3- ttl 5v and they been working, With Nextion it is not the case??

5v from the Nextion may damage the ESP32.
I would use a voltage divider on the Nextion TX line.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.