python3 串口通讯
来源:互联网 发布:贵州云博大数据 编辑:程序博客网 时间:2024/05/22 16:42
import serialimport threadingimport timex=serial.Serial('/dev/ttyUSB1',9600)# i=0def fasong(): while True: #print("wocao") myinput=input('shuru>') myinput=myinput.encode(encoding="utf-8") #print("you input "+myinput) #time.sleep(1) x.write(myinput)def jieshou(): myout="" while True: while x.inWaiting()>0: myout+=x.read(1).decode() if myout!="": print(myout) myout="" #myout=x.read(14) # myout="lll" #time.sleep(1)if __name__== '__main__': t1 = threading.Thread(target=jieshou,name="jieshou") t2= threading.Thread(target=fasong, name="fasong") t2.start() t1.start()
1 0
- python3 串口通讯
- 串口通讯
- 串口通讯
- 串口通讯
- 串口通讯
- 串口通讯
- 串口通讯
- 串口通讯
- 串口通讯
- 串口通讯
- 串口通讯
- 串口通讯
- 串口通讯
- 串口通讯
- 通讯串口
- 串口通讯
- 串口通讯
- 串口通讯
- 从零开始学写HTTP服务器(三)请求资源
- C++ const 用法总结
- 算法入门经典2 第3章解题报告
- 【Leetcode】477. Total Hamming Distance
- 求一个int数是否是4的幂
- python3 串口通讯
- MAC10.12Caps Lock失灵
- SpringMVC 菜鸟教程 3 文件上传 CommonsMultipartResolver
- 大话设计模式-工厂方法模式
- 滑膜控制的基本原理
- CSDN公式编辑
- 日常练习
- Redis集群之主从复制,读写分离(下)(六)
- Android开发——ListView使用技巧总结(一)