不改ARDUINO代码的话需要串口助手需要勾选DTR。

在这里插入图片描述

修改arduino代码后就可以忽略DTR

  Serial.begin(115200);
  Serial.ignoreFlowControl();//增加一段这个代码

在这里插入图片描述

RP2040 Specific SerialUSB methods
void Serial.ignoreFlowControl(bool ignore)
In some cases, the target application will not assert the DTR virtual line, thus preventing writing operations to succeed.

For this reason, the SerialUSB::ignoreFlowControl() method disables the connection’s state verification, enabling the program to write on the port, even though the data might be lost.

bool Serial.dtr()
Returns the current state of the DTR virtual line. A USB CDC host (such as the Arduino serial monitor) typically raises the DTR pin when opening the device, and may lower it when closing the device.

bool Serial.rts()
Returns the current state of the RTS virtual line.

参考连接

Logo

智能硬件社区聚焦AI智能硬件技术生态,汇聚嵌入式AI、物联网硬件开发者,打造交流分享平台,同步全国赛事资讯、开展 OPC 核心人才招募,助力技术落地与开发者成长。

更多推荐