如何解决在Raspberry Pi 4B上无法打开34个以上的串行端口
首先为不好的书面代码道歉。我是初学者。
我尝试使用以下代码同时打开48个串行USB设备:
# performance.py
#import der Libarys
import serial
import time
import sys
serialInterfaces = []
basicpath = "/dev/ttyUSB"
portnum = 47
def close():
for serialIf in serialInterfaces:
serialIf["if"].close()
def Init():
portnumbers = range(portnum)
for port in portnumbers:
serialIf = {
"path": basicpath + str(port),}
serialIf["if"] = serial.Serial(serialIf.get("path"),baudrate=1200,timeout=1)
serialInterfaces.append(serialIf)
print(str(serialIf))
Init()
close()
但是在打开34个串行端口后,树莓派崩溃了。
有人知道我犯了什么错误吗?还是树莓派太弱了?
感谢您的帮助!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。