Hello,
I appreciate that you put so much effort into making Nextion easy to use with your library. It is elegant.
I have used EasyNex myNex(Serial2) with ESP32 for the last two years, and it used to work perfectly. Nevertheless, It stopped yesterday when I tried it again.
Here is an example of how I used to use it: The Nextion first restarted with ESP32 and then went to page home.
This code used to work very well till yesterday.
I tried:
1- Use another ESP32 board ; not work. I still read what I print via the serial monitor.
2- I re-upload the code to an old ESP32, which worked before I flushed it and uploaded the code again. The MCU did not communicate after reuploading the code.
3- I used another Nextion display, it did not work.
4- Use the default Serial pins
EasyNex myNex(Serial);
It worked.
5- I used Arduino boards, Mega and Giga R1 WiFi with EasyNex myNex(Serial2) . It worked perfectly.
#include "EasyNextionLibrary.h" // Include EasyNextionLibrary
EasyNex myNex(Serial2); // Pin 16 = RXD2, Pin 17= TXD2
void setup() {
Serial.begin(115200);
delay(100);
Serial.println("Begin...");
delay(1000);
myNex.begin(115200); // UART 2); // Start with nextion bauds for serial communication.
Serial.println("reset1...");
myNex.writeStr("rest");
delay(1000); // wait till Nextion is restarted
myNex.writeStr("page home"); // Go to page home.
}
void loop() {
//Put your main code here, to run repeatedly:
Serial.println("loop...");
delay(1000);
}
Then I used hardware serial between the EasyNex myNex(Serial2) as follows and it worked with all boards and displays.
#include <EasyNextionLibrary.h>
// Define the RX and TX pins for Serial 2
#define RXD2 16
#define TXD2 17
HardwareSerial mySerial(2); // Initialize Serial 2
EasyNex myNex(mySerial); // Pass the HardwareSerial object to EasyNex
void setup() {
Serial.begin(115200);
Serial.println("Begin...");
delay(1000);
mySerial.begin(115200, SERIAL_8N1, RXD2, TXD2);
// Initialize the EasyNex object
myNex.begin(115200);
//myNex.begin(115200); // UART 2); // Start with nextion bauds for serial communication.
Serial.println("reset1...");
myNex.writeStr("rest");
Serial.println("we go home...");
delay(1000); // wait till Nextion is restarted
myNex.writeStr("page home");
delay(100);
}
void loop() {
Serial.println("loop...");
delay(1000);
}
Would you please advise if something is wrong and why it doesn't work as it does in the fashion way?
Thanks for any help.
Hello,
I appreciate that you put so much effort into making Nextion easy to use with your library. It is elegant.
I have used
EasyNex myNex(Serial2)with ESP32 for the last two years, and it used to work perfectly. Nevertheless, It stopped yesterday when I tried it again.Here is an example of how I used to use it: The Nextion first restarted with ESP32 and then went to page home.
This code used to work very well till yesterday.
I tried:
1- Use another ESP32 board ; not work. I still read what I print via the serial monitor.
2- I re-upload the code to an old ESP32, which worked before I flushed it and uploaded the code again. The MCU did not communicate after reuploading the code.
3- I used another Nextion display, it did not work.
4- Use the default Serial pins
EasyNex myNex(Serial);It worked.
5- I used Arduino boards, Mega and Giga R1 WiFi with
EasyNex myNex(Serial2). It worked perfectly.Then I used hardware serial between the
EasyNex myNex(Serial2)as follows and it worked with all boards and displays.Would you please advise if something is wrong and why it doesn't work as it does in the fashion way?
Thanks for any help.