Python raspberry pi串行sim868登录

2024-04-19 16:23:09 发布

您现在位置:Python中文网/ 问答频道 /正文

为什么有时它会起作用?你知道吗

我试着听从命令。你知道吗

我该怎么修?你知道吗

import serial
import time
port = serial.Serial("/dev/ttyS0", baudrate=115200, timeout=1)
port.write('AT'+'\r\n')
print port.read(10)
time.sleep(.1)

输出 enter image description here


Tags: devimportreadtimeporttimeoutserialsleep
2条回答

尝试将延迟置于读取之前:

time.sleep(.1)
print port.read(10)

也许串行端口保持打开,您需要在再次访问它之前关闭它?你知道吗

相关问题 更多 >