树莓派 Python 获取串口数据 (5)
通过 minicom 测试后,说明串口和其他设备连接工作正常,
我们就应该用编程的方式来获取串口数据了,
以Python为例,要获取串口的数据需要安装Python serial模块
sudo apt-get install python-serial
安装好后先通过python命令,进入python命令行进行测试
python
首先,导入serial模块
import serial
然后打开串口,存放到 ser 中,方法接收一个端口名,和一个波特率
ser = serial.Serial("/dev/ttyAMA0", 115200)
通过ser的read()方法只能获取一个字符,
但read()方法有一个接收字符长度的重载,
首先通过ser.inWaiting()方法获取总长度,再通过ser.read()读取
ser.read(ser.inWaiting())
这样就能获取数据了!我们只需要对read到的数据进行分析、处理即可,写成 .py 脚本即可。
标签:
Linux(19)
相关文章
评论列表(2054) 订阅
禁止评论
Acheter Viagra Paris Sans Ordonnance <a href=http://buycial.com>cialis 20mg for sale</a> Dutasteride How To Buy Para Que Sirve El Cialis Levit
Pfizer Viagra 100mg Buy Cipro 500mg <a href=http://lowpricecial.com>online pharmacy</a> Biosuganril
Viagra Schweiz Rezeptfrei Progesterone Secure Ordering Best Website With Free Shipping <a href=http://cialisong.com>cheapest cialis</a> Victoria Bc Viagra&nb
How To Buy Macrobid <a href=http://purchasecial.com>cialis prices</a> Achat Tadalafil Canada Clobetasol Low Price With Free Shipping. Discount Generic&n
Viagra Alle Erbe Naturale Levitra Ersatz Viagra Kaufen Ohne Rezept Erfahrungen <a href=http://rxbill6.com>levitra and cialis online</a> Side Effects&nbs
No Prescription Zocor Viagra Popular British Websites <a href=http://cheapcheapvia.com>viagra</a> Acheter Cialis 10mg En France
Efectos Viagra Jovenes Generic Amoxicilina Best Website Pharmacy <a href=http://sildenafdosage.com>viagra</a> Zithromax Diarrhea Cheap Buy Propecia Online &n
Chewable Viagra Generic Levitra Tarif Maroc Orlistat 120mg Online No Script <a href=http://exdrugs.com>viagra</a> Kamagra Trop Cher
Cialis Generico En Farmacias Espanolas Baclofene Protocole <a href=http://sildenaf75.com>viagra</a> Walmart Retail Prescription Drug List
Macrobid Express Delivery Shop <a href=http://yafoc.com>presentacion propecia</a> Viagra Con Alcohol
Louer Levitra En Suisse Viagra No Prescription Online <a href=http://getpharmacyonline.com>cialis</a> Name Brand Viagara Kamagra Venta Libre
Cialis Original Y Generico Canadian Meds Prednisone Canada <a href=http://kamxl.com></a> Acticin Elimite Drugs On Line Effetto Viagra Sulle Donne&n
Cialis 5mg Osterreich Propecia Side Effects Spots <a href=http://cialcheap.com>cialis 5mg best price</a> Hydrochlorothiazide Holistic Commander Cialis Soft&n
DennisOwego DennisOwego
http://hoholskiy.ru/member.php/1007-Williamsteks
3249890jk23e455
DennisOwego DennisOwego
http://www.kulturtalk.de/viewtopic.php?f=65&t=6561
https://forumvoyance.fr/viewtopic.php?f=3&t=55978&p=637821#p637821
http://diendan.muthiensu.vn/showthread.php?7244.html#post43633&
DennisOwego DennisOwego
http://www.armagroupe.org/forum/viewtopic.php?f=20&t=266&sid=07bd942013378dce19667644aeb8f019
http://www.annoncexxx.com/forum/viewtopic.php?pid=1579446#p1579446
http://forumcop2.ro/view
DennisOwego DennisOwego
http://foro.toletho.com/viewtopic.php?f=6&t=6110
http://vinhomessaigon.net/forum/viewtopic.php?pid=2745#p2745
http://diendan.muthiensu.vn/showthread.php?7245.html#post43634
http:
AennisOwego DennisOwego
http://armario.by/index.php?subaction=userinfo&user=ibixym
http://hongtouwen.com/home.php?mod=space&username=epebo&do=profile
http://xn--b1aachqmnfhcdurh8l.xn--p1ai/index.php?subact
AennisOwego DennisOwego
http://intechno-plus.com/index.php?subaction=userinfo&user=eludofufu
http://bankira.org/index.php?subaction=userinfo&user=obikajow
https://bbs.emath.ac.cn/space-uid-11629.html
AennisOwego DennisOwego
http://beregovo.info/wuman/index.php?subaction=userinfo&user=ibosaqaqu
http://webskazki.com/index.php?subaction=userinfo&user=udahep
http://apex-moto.ru/forum/?PAGE_NAME=profile_view&am
AennisOwego DennisOwego
http://www.sga-bms.ru/support/forum/view_profile.php?UID=64788
http://webniwa.com/home.php?mod=space&uid=1864760&do=profile
http://sex759.com/home.php?mod=space&uid=43936
AennisOwego DennisOwego
http://www.cqwanli.net/home.php?mod=space&uid=184242
http://mofunt.com/home.php?mod=space&uid=958
http://xn--80a2af9c.xn--p1ai/forum/user/130542/
speedtest2019
AennisOwego DennisOwego
http://proac.ru/forum/user/23920/
http://efanyong.net/home.php?mod=space&uid=25624
http://niagaracn.com/home.php?mod=space&uid=41435
speedtest2019
AennisOwego DennisOwego
http://bbs.xinanda.net/home.php?mod=space&uid=103674
http://9wanli.net/home.php?mod=space&username=elaqu
http://www.ros-org.ru/index.php?name=account&op=info&uname=yqygatyzo&nbs
AennisOwego DennisOwego
http://www.ptn-hk.com/bbs/home.php?mod=space&uid=104235
http://www.mypethome.com/home.php?mod=space&uid=2077006&do=profile
http://akvatopia.ru/rabota/tools.php?event=profile&pna
AennisOwego DennisOwego
http://kuncidewata.com/index.php/forum/user/67601-atahaga
http://xn----qtbocecggch.xn--p1ai/index.php?subaction=userinfo&user=evezew
http://bbs.gulugule.com/home.php?mod=space&uid=4632&
AennisOwego DennisOwego
http://stroller-be.ru/forum/?PAGE_NAME=profile_view&UID=23798
https://meddemo.1c-bitrix.ru/about/forum/user/12219/
http://www2.bigpi.biysk.ru/pf/profile.php?lookup=146414
speedte
AennisOwego DennisOwego
http://lublin.tv/profile.php?lookup=4185
http://travianas.lt/index.php?subaction=userinfo&user=oceqe
https://horoshava.ru/forum/user/4993/
speedtest2019
AennisOwego DennisOwego
http://bbs.chaojitv.com/home.php?mod=space&uid=229440
http://www.successhill.com.hk/member/index.php?uid=ivyxadek
http://www.djkgl.cn/home.php?mod=space&uid=205168
speedtest2
AennisOwego DennisOwego
http://www.banmachenlaibbs.com/home.php?mod=space&uid=167646&do=profile
http://1.qianlai8.com/home.php?mod=space&uid=229799&do=profile
https://www.truthmall.com/home.php?mod=spa
AennisOwego DennisOwego
http://codteamnrv.free.fr/index.php?file=Members&op=detail&autor=obobijim
http://www.rainbowingarden.com/home.php?mod=space&uid=9205
http://bbs.86to81.net/home.php?mod=space&uid
AennisOwego DennisOwego
http://yuanyuanba.com/home.php?mod=space&uid=40728
http://terabyte86.ru/forum/user/8433/
http://bakalcrb.ru/about/forum/user/94568/
speedtest2019
AennisOwego DennisOwego
http://www.data-basis.ru/forums/user/3582-uvupewubo
http://moscowatelier.ru/index.php?subaction=userinfo&user=iligizo
http://eutc.com.ua/forum/index.php/user/4062/
speedtest2019
AennisOwego DennisOwego
http://www.colin-egglesfield.net/gallery/profile.php?uid=17942
https://ul-orient.ru/userinfo.php?uid=34593
http://gymnasium.neftekamsk.ru/profile.php?lookup=6935
speedtest2019
AennisOwego DennisOwego
http://bbs.zszytz.com/home.php?mod=space&uid=139392
http://board.kolibrios.org/memberlist.php?mode=viewprofile&u=8394
http://namieirsode.lt/index.php?subaction=userinfo&user=ewehu&n
AennisOwego DennisOwego
https://novagielda.pl/forum/memberlist.php?mode=viewprofile&u=7109
http://parafiasulbiny.org/profile.php?lookup=10282
http://gromada.ru/forum/?PAGE_NAME=profile_view&UID=36602
AennisOwego DennisOwego
http://ukkadri.ru/index.php?subaction=userinfo&user=opepifeb
http://74door.ru/forum/user/133068/
http://desire6688.com/home.php?mod=space&uid=390604&do=profile
speedtest2
AennisOwego DennisOwego
http://www.marheavenj.net/public/gallery/member.php?action=showprofile&user_id=6937
http://itogo.ua/communication/forum/index.php?PAGE_NAME=profile_view&UID=59767
http://autofaq.com.ua/
online payday loans http://paydayloansykqw.com/ - loans loans <a href="http://paydayloansykqw.com/#">payday loans</a> loans http://paydayloansykqw.com/
loan bad credit http://badcreditloanshtze.com/ - small loan bad credit payday loans bad credit <a href="http://badcreditloanshtze.com/#">bad credit lenders<
personal loan interest rates http://personalloansshyk.com/ - small personal loans find personal loan <a href="http://personalloansshyk.com/#">personal loan</a>&nbs
cash advance usa http://cashadvancerfdh.com/ - discover cash advance online cash advance <a href="http://cashadvancerfdh.com/#">cash advance fee</a> п»їcash&n
online payday loan http://paydayloansikdc.com/ - п»їloan payday loans online <a href="http://paydayloansikdc.com/#">loan</a> online payday loans no credit&nbs
https://currency-trading-brokers.com/forex-comparisons-ratings-reviews-thailand.html บทวิเคราะห์-ภาพรวม-ตรวจทาน ลูกข่าง-ด้านบน-บนสุด Forex-ฟอเร็กซ์-โฟ-อัตราแลกเปลี่ยน บริษัท.
cash advance online same day http://cashadvanceafc.com/ - cash advance fee cash advance america <a href="http://cashadvanceafc.com/#">advance america cash 
Представим, вы собственник нового вебсайта, который имеет приятный дизайн, удобную навигацию и нужную для посетителей рекламную информацию. Но на онлайн-проект&
duloxetine dr 30mg http://duloxetinecymbaltdfr.com/ - cymbalta medication duloxetine hcl <a href="http://duloxetinecymbaltdfr.com/#">cymbalta dosage</a> duloxetine hcl
viagra samples http://buyonlinewwwmen.com/ - generic viagra online viagra without a doctor prescription <a href="http://buyonlinewwwmen.com/#">cheap viagra</a>&nbs
personal loans bad credit http://personalloansshyk.com/ - personal loan rates personal loan bad credit <a href="http://personalloansshyk.com/#">bad credit pers
coumadine http://warfarincoumadinsg.com/ - coumadin warfarin diet <a href="http://warfarincoumadinsg.com/#">coumadin clinic</a> warfarin diet