Cov txheej txheem:

Tswj lub TV thiab Txuas Raspberry Pi Nrog Tib Qhov Chaw Nyob: 4 Kauj Ruam
Tswj lub TV thiab Txuas Raspberry Pi Nrog Tib Qhov Chaw Nyob: 4 Kauj Ruam

Video: Tswj lub TV thiab Txuas Raspberry Pi Nrog Tib Qhov Chaw Nyob: 4 Kauj Ruam

Video: Tswj lub TV thiab Txuas Raspberry Pi Nrog Tib Qhov Chaw Nyob: 4 Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Tswj lub TV thiab Txuas Raspberry Pi Nrog Tib Qhov Chaw
Tswj lub TV thiab Txuas Raspberry Pi Nrog Tib Qhov Chaw

Txhawm rau tswj Raspberry Pi nrog Infrared chaw taws teeb, peb tau siv tau LIRC. Qhov ntawd tau siv ua haujlwm kom txog thaum Kernel 4.19. X thaum nws dhau los ua qhov nyuaj dua kom tau LIRC los ua haujlwm. Hauv txoj haujlwm no peb muaj Raspberry Pi 3 B+ txuas nrog TV thiab peb yuav tsum tshem cov keyboard thiab nas. Peb yuav tsis xav tau teeb tsa LIRC ntawm RPi lossis lwm yam cuab yeej uas peb siv txoj haujlwm no nrog uas yuav pub dawb cov peev txheej.

Khoom siv

  • Arduino Pro Micro Cov
  • IR sensor
  • Micro USB kab

Kauj Ruam 1: Solder IR Sensor ntawm Arduino Pro Micro

Solder IR Sensor ntawm Arduino Pro Micro
Solder IR Sensor ntawm Arduino Pro Micro
Solder IR Sensor ntawm Arduino Pro Micro
Solder IR Sensor ntawm Arduino Pro Micro
Solder IR Sensor ntawm Arduino Pro Micro
Solder IR Sensor ntawm Arduino Pro Micro
Solder IR Sensor ntawm Arduino Pro Micro
Solder IR Sensor ntawm Arduino Pro Micro

TSOP1836 IR sensor muaj peb tus pin: Teeb liab, GND, thiab Vcc. Xyuas kom tseeb tias koj saib pinout rau koj lub sensor ua ntej soldering. Tom ntej no, Solder sensor's GND to board's GND, sensors's Vcc to board's, and sensor's Signal to pin 2 of Arduino Pro Micro. Tsis txhob hnov qab qhwv lub rooj tsavxwm kom tiv thaiv nws, tab sis tso lub sensor tso tawm.

Kauj ruam 2: Upload Code rau Arduino Pro Micro

Upload Code rau Arduino Pro Micro
Upload Code rau Arduino Pro Micro

Cov lej tuaj yeem pom hauv Github.

Kauj Ruam 3: Tau Txais Koj Cov Chaw Taws Teeb

Tau Txais Koj Cov Chaw Taws Teeb
Tau Txais Koj Cov Chaw Taws Teeb

Muaj qhov tsawg heev uas koj cov cai yuav ua haujlwm tam sim no thiab koj yuav ua tiav nrog txoj haujlwm no. Rau feem coob ntawm cov neeg tsim khoom uas tsis siv tib lub chaw deb ib yam li kuv, koj yuav tsum nyeem koj cov lej nyob deb. Qhib Arduino IDE Serial Monitor thiab xyuas kom tseeb tias Baud Rate sib xws yam peb muaj hauv cov cai hauv kab "Serial.begin (115200);". Taw koj lub chaw taws teeb ntawm IR sensor tom qab nias ib lub pob thiab tso tawm sai kom tau txais tsawg kawg ob kab hauv Serial Monitor. Thawj kab yog tus lej rau khawm thiab kab hauv qab no yog qhov chaw nyob deb ntawm txoj kev hais tias tsuas yog rov ua dua tus lej kawg.

Kauj Ruam 4: Hloov Kho Koj Arduino Pro Micro Sketch thiab Tshaj Tawm Ntxiv

Hloov Kho Koj Arduino Pro Micro Sketch thiab Tshaj Tawm Ntxiv
Hloov Kho Koj Arduino Pro Micro Sketch thiab Tshaj Tawm Ntxiv

Koj yuav pom ob yam ntawm cov lej nyob deb hauv daim duab uas koj rub tawm los ntawm Github:

  • Rov ua dua: siv rau kev txav nas (tuav lub pob kom txav nas)
  • Tsis rov ua dua: siv rau ib zaug nias lub pob xws li sab laug nas khawm nyem

Ntxiv rau cov cai koj tau txais los ntawm cov kauj ruam dhau los, koj yuav tsum hloov kho qhov loj me ntawm "const int ButtonCount" uas yog 32 hauv kuv daim duab kos vim tias kuv muaj 32 khawm cov lej txhais hauv ResultsValues [ButtonCount].

Qhov kawg tab sis tsis tsawg, koj yuav tsum hloov kho kab hauv qab no:

yog (Results.value == 4294967295) rau (int i = 0; i <ButtonCount; i ++) AllButtons = RepeatCode ;

Hloov 4294967295 nrog cov lej rov ua dua ntawm koj lub chaw taws teeb. Txoj cai ntawd tuaj yeem tau txais los ntawm cov kauj ruam dhau los los ntawm kev tuav ib lub khawm nyob deb. Txoj cai rov ua dua yuav yog cov lej qhia ntau zaus.

Pom zoo: