不改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

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐