使用python在openwrt下操作串口发送十六进制数据

版权声明:讯客+是一个每天更新的带你薅羊毛的撸羊毛网站,欢迎访问(www.xunkejia.com)。 https://blog.csdn.net/qq_17351077/article/details/78600825
#!/usr/bin/python
import serial

from time import sleep

ser = serial.Serial('/dev/ttyS0', 9600, timeout=0.5)

print ser.port
print ser.baudrate

if __name__ == '__main__':
    data=b'\xAA\xBB\x06\x00\x00\x00\x01\x01\x02\x02'
    while True:
        print data
        ser.write(data)
        sleep(1)

猜你喜欢

转载自blog.csdn.net/qq_17351077/article/details/78600825
今日推荐