1
我通過串口寫一些數據,我有一個問題,從閱讀該設備的響應。
例子:
ser.write('Hello World')
print(ser.readline()) #Instead of reading the response from the
#other device, it reads 'Hello world'
我已經爲這個問題的解決方法,通過調用兩倍的ReadLine(),而不是關心的第一個。這樣(的作品),它讀取從其他設備發送的數據
ser.write('Hello World')
ser.readline()
print(ser.readline())
似乎對我發送的數據將保留在緩衝區?當調用readline()時,它會首先發出紅色?!
有人能爲我解釋我做錯了什麼嗎?
謝謝!
你說得對,問題出在設備上,設置了本地回顯ON – Kszili