在Python中COM口的調用方法
更新時間:2019年07月03日 11:15:43 作者:呱呱王子
今天小編就為大家分享一篇在Python中COM口的調用方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
如下所示:
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口的調用方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
Python 利用scrapy爬蟲通過短短50行代碼下載整站短視頻
近日,有朋友向我求助一件小事兒,他在一個短視頻app上看到一個好玩兒的段子,想下載下來,可死活找不到下載的方法。經過我的一番研究才找到解決方法,下面小編給大家分享Python 利用scrapy爬蟲通過短短50行代碼下載整站短視頻的方法,感興趣的朋友一起看看吧2018-10-10
Python?selenium下拉選擇框實戰(zhàn)應用例子
Selenium是一個開源的和便攜式的自動化軟件測試工具,用于測試Web應用程序有能力在不同的瀏覽器和操作系統(tǒng)運行,下面這篇文章主要給大家介紹了關于Python?selenium下拉選擇框實戰(zhàn)應用的相關資料,需要的朋友可以參考下2022-07-07

