questions about serials

Hi! I'm using the Nextion display on serial2 to test my applications on ESP32.
So, the display is connected to the TX2 / RX2 and I load the sketch on the ESP32 and energized with the USB.

But now I need to use ESP32 on Serial0 because I will have to use a barcode reader on Serial2 and I don't know how to do that.

I looked at the Nextion library and in the NexConfig.h file there is information about serials, how the library was sent to me, I don't know what to modify, it looks like this:

/** 
 * Define DEBUG_SERIAL_ENABLE to enable debug serial. 
 * Comment it to disable debug serial. 
 */
//#define DEBUG_SERIAL_ENABLE

/**
 * Define dbSerial for the output of debug messages. 
 */
#define dbSerial Serial

/**
 * Define nexSerial for communicate with Nextion touch panel. 
 */
#define nexSerial Serial2


#ifdef DEBUG_SERIAL_ENABLE
#define dbSerialPrint(a)    dbSerial.print(a)
#define dbSerialPrintln(a)  dbSerial.println(a)
#define dbSerialBegin(a)    dbSerial.begin(a)
#else
#define dbSerialPrint(a)    do{}while(0)
#define dbSerialPrintln(a)  do{}while(0)
#define dbSerialBegin(a)    do{}while(0)
#endif

/**
 * @}
 */

#endif /* #ifndef __NEXCONFIG_H__ */

I also didn't find much information about it in the documentation. Can anyone help me?

Thank you!

It's defined here:

/**
 * Define nexSerial for communicate with Nextion touch panel.
 */
#define nexSerial Serial2

Just change this line

#define nexSerial Serial2

to whatever serial port you are using.... As is, it is using Serial2 so change to to your port

ESP32 also has a Serial1 but you need to change the default pins used
see SeialComs
for the details

I got it, thanks!

What is the difference between dbSerial and nexSerial?