在Python中COM口的调用方法
如下所示:
importserial
importtime
t=serial.Serial('com6',115200)#USBCOMnumberonyourPCandthetransferbitrateoftheCOMport.
printt.portstr#DisplaytheworkingUARTportnumberonyourPC.
n=t.write('logcat-c\r')
n=t.write('ampclient_samples2-O3/mnt/media_rw/B278-E25A/video_google_clips/New_Webm/bunny_1080P.webm\r')
time.sleep(3)
print"Doesthestreamoutputnormally?Yes=1orNo=2"
Input=int(raw_input())
ifInput==1:
print"Pass!!!"
n=t.write(chr(0x03))#CallforCtrl+CcommandinUARTport
n=t.write('logcat-c\r')
else:
print"Fail!!!"
n=t.write(chr(0x03))
#n=t.write('logcat-vthreadtime/r')
以上这篇在Python中COM口的调用方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持毛票票。
热门推荐
10 干杯生日祝福语简短独特
11 高考庆祝宴祝福语简短
12 简短空间祝福语 搜
13 出远门文案祝福语简短
14 科研文案祝福语简短精辟
15 清晨寄语诗句祝福语简短
16 端午祝福语简短送老师
17 骑手搞笑祝福语大全简短
18 找个帅哥结婚祝福语简短