我一直在关注这个教程:https://circuitdigest.com/microcontroller-projects/arduino-python-tutorial
import pyserial
没有返回任何错误,但是当我运行我的python代码时,我收到以下错误:
SerialException: could not open port 'com18': WindowsError(2, 'The system cannot find the file specified.')
有人知道怎么修这个东西吗?
我复制了你在教程中可以阅读的内容:
ArduinoSerial = serial.Serial('com18',9600)
注意:提及正确的COM端口名称非常重要。可以使用计算机上的设备管理器找到它。
当您插入arduino时,Windows已选择另一个COM编号。
该端口可以直接在arduino IDE中找到。它可以检测USB上连接的所有设备;但IDE不知道哪个是你的arduino。在菜单工具/端口中,您将看到计算机上的COM列表。
如果没有提出COM,那么你错过了Windows下的卡驱动程序 - > google for it。