我在尝试使用python打印来自串行端口的gps数据时遇到问题
用于打印数据的代码:
while True:
serialInst.write('at+cgpsinfo\r'.encode('utf-8'))
sleep(1)
packet = serialInst.readline()
packet_decodificat = packet.decode('utf-8')
print(packet_decodificat)
但这就是结果:
OK
<-- here is printing an empty line where the gps data should've been...
这是我使用simcom工具发送AT命令时的输出:
2021-05-11 19:18:15:065[Send->]at+cgpsinfo
2021-05-11 19:18:15:073[Recv<-]
OK
2021-05-11 19:18:15:790[Recv<-]
+CGPSINFO: 478.215547,N,2734.862213,E,100521,161816.0,80.4,0.0,0.0
我是python新手,所以我的代码中可能有一个我不知道的明显错误:D
目前没有回答
相关问题 更多 >
编程相关推荐