Python串行通信接收命令未知



所以我试图通过串行(USB-A到USB-B)控制一个热浴,当我发送命令时,我会得到响应" F001",告诉我该命令已知。格式是"命令"马车返回",这是我拥有的:

ser = serial.Serial('/dev/tty.usbserial-A800dars', 9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=5) #no timeout=0
print(ser.name)                         # check which port was really used
ser.write(b'RTr')                      # read internal temp
# TODO probably not getting 100 bytes here, need to find what to expect and whether or not to do a timeout
serial_response = ser.read(100)         # read up to one hundred bytes or as much is in the buffer
print(serial_response)

我尝试在 r之后添加一个 n,我尝试了其他多个命令,我在RT和 r之间包括了一个空间,并且我将温度浴中的波特率设置为与我在串行上发送的一样。我还确保从http://www.ftdichip.com/ftdrivers.htm。

有什么想法吗?我使用的是Mac,将USB-A上的USB-B电缆发送到USB-B电缆,并且在温度浴打开并运行时只会得到F001的响应。

,事实证明,制造商给了我错误的手册。找到正确的一个,现在知道正确的命令以通过串行发送以上所有代码的效果很好。

最新更新