Problem with display nextion

Hi

I have a problem, I'm using Nextion with ESP32, and I need to debug with dbSerial. I'm using the ITEADLIB_Arduino_Nextion library. When assembling, I connect the Nextion display to the RX2 and TX2 and load and power the ESP32 with the USB cable. In the library, nexConfig.h 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

And this is my code:

#include <Nextion.h>
NexButton btnStart = NexButton(0, 2, "b0");
NexPage page0 = NexPage(0, 0, "page0");
NexPage page1 = NexPage(1, 0, "page1");

NexTouch *nex_listen_list[] =
{
  &btnStart,
  NULL
};

int page = 0;

void setup() {

  Serial.begin(115200);
  nexInit();
  btnStart.attachPush(startPage, &btnStart);

}

void loop() {

  switch (page)
  {
    case 0:
      page0.show();
      break;
    case 1:
      page1.show();
      break;
  }

}

void startPage(void *ptr)
{
  dbSerialPrintln("START FUNCTION");
  page = 1;
}

However, when loading the code and opening the serial monitor, I get the following error:

recvRetCommandFinished err

can anybody help me?

I dont know why that happens...

Thanks!

When I compare your code with this tutorial, then a nexLoop(nex_listen_list); is missing.

Are you calling page0.show() all the time when the page is 0 ?

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