c++ - 显示 nextion - dbSerial 和 nexSerial
问题描述
我有一个问题,我正在使用带有 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>
谢谢!
解决方案
推荐阅读
- json.net - 无法创建和填充列表类型 System.Data.SqlClient.SqlErrorCollection。路径“$值”
- python - 仅返回表的第一行值
- java - 尝试使用 java JDK 的 Ubuntu Snap vscode 错误
- java - JSON 解析错误:无法从 START_OBJECT 令牌中反序列化 `java.util.ArrayList` 的实例
- jsf - 如何部分拆分 Primefaces 数据表的每一行?
- c - 当程序有大量输出时,带有 cmd.exe 的 CreateProcess 挂起
- unity3d - GameObject.Find 不使用字符串 var
- c - 如何在 C 中找到孙 pid?
- c - 如何摆脱分段错误?
- usrp - 在雷达应用中使用 Ettus USRP