我有一个问题,我正在使用带有 ESP32 的 Nextion,我需要使用 dbSerial 进行调试。我正在使用 ITEADLIB_Arduino_Nextion 库。组装时,我将 Nextion 显示器连接到 RX2 和 TX2,并使用 USB 电缆为 ESP32 加载和供电。在库中,nexConfig.h 如下所示:
/**
* 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
这是我的代码:
#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;
}
但是,在加载代码并打开串行监视器时,出现以下错误:
recvRetCommandFinished err
有谁能够帮我?
我不知道为什么会这样……</p>
谢谢!