在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口的调用方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持毛票票。