Cov txheej txheem:

Teeb Yooj Yim IR Kev Tswj Chaw Taws Teeb Siv LIRC rau Raspberry PI (RPi) - Lub Xya Hli 2019 [Ntu 2]: 3 Cov Kauj Ruam
Teeb Yooj Yim IR Kev Tswj Chaw Taws Teeb Siv LIRC rau Raspberry PI (RPi) - Lub Xya Hli 2019 [Ntu 2]: 3 Cov Kauj Ruam

Video: Teeb Yooj Yim IR Kev Tswj Chaw Taws Teeb Siv LIRC rau Raspberry PI (RPi) - Lub Xya Hli 2019 [Ntu 2]: 3 Cov Kauj Ruam

Video: Teeb Yooj Yim IR Kev Tswj Chaw Taws Teeb Siv LIRC rau Raspberry PI (RPi) - Lub Xya Hli 2019 [Ntu 2]: 3 Cov Kauj Ruam
Video: Python! Flattening Nested Lists 2024, Kaum ib hlis
Anonim
Teeb Yooj Yim IR Kev Tswj Chaw Taws Teeb Siv LIRC rau Raspberry PI (RPi) - Lub Xya Hli 2019 [Ntu 2]
Teeb Yooj Yim IR Kev Tswj Chaw Taws Teeb Siv LIRC rau Raspberry PI (RPi) - Lub Xya Hli 2019 [Ntu 2]

Hauv Ntu 1 Kuv tau qhia yuav ua li cas sib sau RPi + VS1838b thiab teeb tsa Raspbian's LIRC module kom tau txais IR cov lus txib los ntawm IR chaw taws teeb. Txhua qhov teeb meem kho vajtse thiab LIRC teeb tsa tau tham hauv ntu 1. Ntu 2 yuav qhia pom yuav ua li cas cuam tshuam nrog kho vajtse + LIRC module peb teeb tsa hauv Tshooj 1 nrog nab hab sej.

Tej thaj chaw deb [IR Tau Txais + RPI] LIRC Pythondisplay (lossis xa).

Khoom siv

tsis muaj

Kauj Ruam 1: Nkaum Devinput.lircd.conf

Nkaum Devinput.lircd.conf
Nkaum Devinput.lircd.conf

Koj cov ntaub ntawv teeb tsa nyob deb yuav muab tso rau hauv /etc/lirc/lircd.conf.d cov npe. LIRC yuav pom cov ntaub ntawv hauv phau ntawv no tsuav nws muaj qhov txuas.conf (piv txwv li: JVC.lircd.conf). Peb yuav tsis siv cov ntaub ntawv devinput.lircd.conf yog li peb yuav zais nws los ntawm kev hloov qhov txuas ntxiv raws li hauv qab no los ntawm kev hloov npe devinput.lircd.conf rau devinput.lircd.conf.copy

$ sudo mv /etc/lirc/lircd.conf.d/devinput.lircd.conf /etc/lirc/lircd.conf.d/devinput.lircd.conf.copy

Kauj ruam 2: Rub tawm.conf Cov Ntaub Ntawv rau Koj Cov Chaw Taws Teeb

Rub tawm.conf Cov Ntaub Ntawv rau Koj Cov Chaw Taws Teeb
Rub tawm.conf Cov Ntaub Ntawv rau Koj Cov Chaw Taws Teeb

Nyob deb ntawm txoj hauv kev yooj yim kom tau txais cov ntaub ntawv nyob deb.conf yog rub nws los ntawm lub tsev qiv ntawv loj ntawm lirc.sourceforge.net Txawm hais tias koj tus qauv nyob deb tsis tau teev npe nws yog qhov zoo heev uas lwm tus qauv los ntawm tib lub chaw tsim khoom yuav ua haujlwm zoo. Tsuas yog nrhiav cov chaw tsim khoom ntawm koj lub chaw taws teeb thiab nyem rau ntawm tus qauv uas ze. Yog tias koj tsis paub meej tias tus qauv twg nyob ze koj tuaj yeem saib cov ntsiab lus ntawm txhua tus qauv thiab nrhiav ib qho uas ze rau koj li.

Txoj hauv kev nyuaj kom tau txais.conf cov ntaub ntawv yog los tsim koj tus kheej siv cov cuab yeej tsim nyob hauv lub kaw lus tab sis kuv tsis tau ua tiav los sim tsim cov ntawv siv cov khoom siv no txawm tias siv zog ntau npaum li cas. Muaj ntau ntau lwm tus neeg uas muaj teeb meem zoo li siv irrecord thiab kuv pom zoo kom txoj hauv kev yooj yim ntawm rub tawm.conf cov ntaub ntawv los ntawm lirc.sourceforge.net

Koj cov ntaub ntawv teeb tsa nyob deb yuav muab tso rau hauv /etc/lirc/lircd.conf.d cov npe. LIRC yuav pom cov ntaub ntawv hauv phau ntawv no tsuav nws muaj qhov txuas.conf (piv txwv li: JVC.lircd.conf).

Kauj ruam 3: Python Code

Python Code
Python Code

Nov yog qee qhov chaws los sim.

los ntawm lirc ntshuam RawConnection

def txheej txheem IRRemote ():

#get IR hais kom ua #keypress hom = (hexcode, repeat_num, command_key, remote_id) sim: keypress = conn.readline (.0001) tshwj tsis yog: keypress = "" yog (keypress! = "" thiab keypress! = Tsis muaj): data = keypress.split () ntu = cov ntaub ntawv [1] hais kom ua = cov ntaub ntawv [2] #ignore hais kom rov ua dua yog (ntu! = "00"): rov luam tawm (hais kom ua)

#define Ntiaj Teb

cov = RawConnection ()

print ("Pib Pib …")

thaum Muaj Tseeb:

Txheej txheem IRRemote ()

Pom zoo: