在Python中COM口的調(diào)用方法
更新時間:2019年07月03日 11:15:43 作者:呱呱王子
今天小編就為大家分享一篇在Python中COM口的調(diào)用方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
如下所示:
import serial
import time
t = serial.Serial('com6', 115200) #USB COM number on your PC and the transfer bit rate of the COM port.
print t.portstr #Display the working UART port number on your PC.
n = t.write('logcat -c \r')
n = t.write('ampclient_samples 2 -O 3 /mnt/media_rw/B278-E25A/video_google_clips/New_Webm/bunny_1080P.webm \r')
time.sleep(3)
print "Does the stream output normally? Yes=1 or No=2"
Input = int(raw_input())
if Input == 1:
print "Pass!!!"
n = t.write(chr(0x03)) #Call for Ctrl+C command in UART port
n = t.write('logcat -c \r')
else:
print "Fail!!!"
n = t.write(chr(0x03))
#n = t.write('logcat -v threadtime /r')
以上這篇在Python中COM口的調(diào)用方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
Python實現(xiàn)SICP賦值和局部狀態(tài)
這篇文章主要介紹了Python實現(xiàn)SICP 賦值和局部狀態(tài)的相關(guān)知識,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-03-03
利用Python判斷整數(shù)是否是回文數(shù)的3種方法總結(jié)
這篇文章主要給大家介紹了關(guān)于如何利用Python判斷整數(shù)是否是回文數(shù)的3種方總結(jié),回文數(shù)是指正序(從左向右)和倒序(從右向左)讀都是一樣的整數(shù),需要的朋友可以參考下2021-07-07
python 刪除系統(tǒng)中的文件(按時間,大小,擴展名)
這篇文章主要介紹了python 如何刪除系統(tǒng)中的文件,分別按時間,大小,擴展名刪除,滿足不同需求,感興趣的朋友可以了解下2020-11-11

