Cov txheej txheem:

GrimmsBox: Tsim Koj Tus Kheej Dab Neeg: 5 Cov Kauj Ruam (nrog Duab)
GrimmsBox: Tsim Koj Tus Kheej Dab Neeg: 5 Cov Kauj Ruam (nrog Duab)

Video: GrimmsBox: Tsim Koj Tus Kheej Dab Neeg: 5 Cov Kauj Ruam (nrog Duab)

Video: GrimmsBox: Tsim Koj Tus Kheej Dab Neeg: 5 Cov Kauj Ruam (nrog Duab)
Video: Cas Tsis Xaiv Koj - R-Lin Thoj New Song Original By Zaj Dub [Official MV] 2023 2024, Hlis ntuj nqeg
Anonim
GrimmsBox: Tsim Koj Tus Kheej Dab Neeg
GrimmsBox: Tsim Koj Tus Kheej Dab Neeg

Cov lus qhia no yuav qhia koj li cas koj tsim koj tus kheej lub thawv dab neeg. Xav tias dawb los xaiv koj tus kheej taug txuj kev nyuaj.

Qhov hu ua "GrimmsBox" yog txoj haujlwm los ntawm cov tub ntxhais kawm los ntawm Hochschule der Medien Stuttgart, Lub Tebchaws Yelemees. Peb siv lub tshuab luam ntawv ib txwm siv los luam tawm thawj feem ntawm zaj dab neeg. Qhov kawg ntawm ntu kev txiav txim siab yuav tsum tau ua. Siv cov nyees khawm koj tuaj yeem xaiv seb zaj dab neeg yuav mus li cas. Peb siv Raspberry Pi los ua haujlwm software.

Ob ntawm Lub Thawv yuav siv sai sai no. Cov tsev qiv ntawv pej xeem hauv Mannheim tab tom npaj kev cob qhia nrog menyuam yaus. Cov menyuam tuaj yeem tsim lawv tus kheej cov dab neeg thiab lawv tuaj yeem ntsib lawv cov dab neeg nrog kev pab ntawm GrimmsBox. Lub hom phiaj tseem ceeb ntawm kev cob qhia yog txhawb kev nyeem ntawv thiab kev muaj peev xwm. Qhov lus piav qhia lub thawv yuav raug coj mus rau cov xwm txheej yog li cov menyuam los ntawm chav kawm 3 txog 6 yuav raug nthuav qhia rau kev paub nyeem ntawv.

Kauj Ruam 1: Yuav Ua Li Cas Rau GrimmsBox

Yuav Ua Li Cas Rau GrimmsBox
Yuav Ua Li Cas Rau GrimmsBox

Cov ntaub ntawv xav tau:

  • 1x 6 hli plywood phaj (1200x600x6mm)
  • 1x 4 hli plywood phaj (1200x600x4mm)
  • ntoo kua nplaum
  • cov cuab yeej xav tau: tshuab txiav laser, khoos phis tawj

Cov ntaub ntawv siv los ntawm GrimmsBox muaj raws li rub tawm dawb. Cov ntaub ntawv yog svg thiab dxf cov ntaub ntawv ntawm cov khoom ib leeg ntawm GrimmsBox. Nov yog ntawm ib sab kev hloov pauv uas Raspberry Pi pom nws qhov chaw, tom qab ntawv phau ntawv khoov pob khawm thiab phau ntawv tsim tus kheej sawv.

6mm plywood phaj yog siv rau kev hloov pauv thiab phau ntawv sawv ntsug. Phau ntawv tau txiav tawm ntawm 4mm plywood phaj. Cov phaj tuab yuav tuab dhau los ua phau ntawv. Dabtsi yog khoov pob khawm tsuas ua haujlwm nrog 3-4mm plywood panels. Txwv tsis pub, nws yuav tawg.

Cov ntaub ntawv dxf yog qhov kev xaiv raug rau cov uas tsis xav hloov dab tsi ntxiv lawm. Cov no tau npaj los siv ntawm lub tshuab txiav laser.

Tab sis rau cov uas tseem xav muab lub thawv rau lawv tus kheej, tuaj yeem siv SVG cov ntaub ntawv hauv lub thawv. Cov no tuaj yeem hloov pauv raws li qhov xav tau. Txhawm rau ua qhov no, cov ntawv yuav tsum tau qhib hauv qhov program (piv txwv li Inkscape). Nrog rau cov khoos kas no koj tuaj yeem hloov kho tus kheej. Yog tias koj tau hloov qee yam (piv txwv li qhov loj ntawm lub qhov rau cov nyees khawm lossis rub ib ncig) koj yuav tsum khaws SVG cov ntaub ntawv ua dxf cov ntaub ntawv.

Cov ntaub ntawv dxf yuav tsum qhib ntawm lub tshuab txiav laser. Sai li sai tau cov ntaub ntawv raug teeb tsa hauv PC, nws yuav tsum raug xaiv cov kab twg yuav raug txiav thiab yam twg yuav tsum tau kos. Cov ntawv ntawm ib sab ntawm lub npov tau sau rau ntawm Grimm lub thawv thiab cov ntawv ntawm phau ntawv tau txiav tsis zoo. Nyob ntawm seb koj nyiam dab tsi zoo dua, koj tuaj yeem siv ib lossis lwm yam. Cov kab sab nrauv yuav tsum yog txhua yam raug txiav. Txawm li cas los xij, kev siv lub tshuab txiav laser tuaj yeem nyob ntawm tus qauv ntawm lub tshuab txiav laser thiab tuaj yeem sib txawv.

Kauj Ruam 2: Yuav Ua Li Cas Sau Cov Khawm rau GrimmsBox

Yuav Ua Li Cas Sau Cov Khawm rau GrimmsBox
Yuav Ua Li Cas Sau Cov Khawm rau GrimmsBox
Yuav Ua Li Cas Sau Cov Khawm rau GrimmsBox
Yuav Ua Li Cas Sau Cov Khawm rau GrimmsBox
Yuav Ua Li Cas Sau Cov Khawm rau GrimmsBox
Yuav Ua Li Cas Sau Cov Khawm rau GrimmsBox
Yuav Ua Li Cas Sau Cov Khawm rau GrimmsBox
Yuav Ua Li Cas Sau Cov Khawm rau GrimmsBox

Cov ntaub ntawv xav tau:

  • 6 ib txwm qhib lub laub khawm ib ntus, piv txwv li cov nyees khawm rau arcade gaming
  • 8 jumper xov hlau nrog tsawg kawg ib tus poj niam xaus, peb li ntev txog 40 cm
  • ib co braid
  • tshav kub-ntsws tubing lub thawv siv rau koj txoj haujlwm, hauv peb cov ntaub ntawv laser-cutted sab saum toj npog thiab ob sab npog uas suav nrog cov nyees khawm ntxiv
  • solder thiab ib tug soldering hlau
  • ntau-meter
  • hlau txiav
  • hlau stripper
  • sib zog los yog rab phom cua kub
  1. Hauv peb cov cai peb siv sab hauv sab hauv, yog li peb tsuas yog yuav tsum ua ob yam: ua ntej, txuas tus poj niam jumper xaim rau txhua lub pob uas yuav ua rau tus lej GPIO tus pin thiab thib ob, txuas cov nyees khawm rau ib leeg, uas tom qab ntawd yuav coj mus mus rau hauv av ntawm lwm tus poj niam jumper xaim. Peb txuas lub pob kaw thiab lub kaw lus rov pib ua haujlwm ua ke thiab siv ib tus pin hauv av rau lawv. Plaub lub nyees khawm uas yuav siv los ntawm kev xaiv-koj-tus kheej-taug txuj kev nyuaj cav kuj tau txuas rau ib leeg thiab sib koom ib tus pin hauv av.
  2. Yog tias koj cov nyees khawm muaj ntau dua ob tus pin, siv lub multimeter los txiav txim seb cov twg haum rau txuas GPIO tus pin thiab hauv av. Nrog lub suab ua haujlwm, koj yuav tsum tsuas yog hnov lub suab yog tias koj kov ob tus pin thiab lub pob tam sim no raug thawb. Koj tuaj yeem ua qhov kev ntsuas txuas mus ntxiv, phau ntawv qhia yuav ua li cas thiaj muaj nyob ntawm ifixit:
  3. Siv ib lub pob thiab ntxig nws rau hauv lub thawv ntu. Nqa ib qho ntawm cov xov hlau jumper thiab txiav ntawm ib kawg, uas yuav tsum tso koj nrog lub xaim xaim xaim nrog ib tus poj niam xaus. Siv cov hlua hlau txiav los ntawm kwv yees li 5 millimeters ntawm qhov kev rho tawm. Twist cov xaim xaim me ntsis kom tsis muaj ib txoj hlua txuas tawm. Siv me me los ua ib txheej zoo rau cov xov hlau. Yog tias koj yog tus tshiab rau kev siv tshuaj yaj yeeb, muaj qhov zoo, luv luv phau ntawv dab neeg qhia koj yuav ua li cas thiaj li yuav yaj tau. Nws hu ua Soldering tau yooj yim thiab PDF muaj ntau yam lus ntawm https://mightyohm.com/blog/2011/04/soldering-is-e… Ntsuas thiab txiav cov cua sov-ntsws tubing, uas koj yuav siv los cais cov qhov chaw uas lub khawm thiab lub xaim xaim yuav muab sib dhos ua ke. Rub lub tshav kub-ntsws tubing hla lub jumper xaim. Muab cov hlua hlau txuas rau ib qho ntawm tus pin ntawm lub pob.
  4. Rov ua cov kauj ruam kawg rau txhua lub khawm. Ib txwm nco ntsoov rub lub tshav kub-ntsws tubing hla lub jumper hlau ua ntej yuav siv cov khoom siv, vim nws yuav tsis haum rau ntawm qhov txuas.
  5. Tam sim no koj yuav txuas lub pob kaw thiab khawm rov pib dua. Peb tau siv cov xaim tooj liab xaim, tab sis raws li nws ua pov thawj me ntsis, kuv xav qhia kom siv braid ib txwm. Txiav ib co centimeters ntawm braid. Ib yam li ua ntej, tshem tawm nws siv cov hlua hlau, tab sis lub sijhawm no ntawm ob qho kawg. Tom qab ntawd, txuas ib qho kawg rau tus pin ntawm qhov kaw lossis khawm rov pib dua. Ib zaug ntxiv, txiav me ntsis ntawm cov cua sov-ntsws tubing thiab rub nws hla txoj hlua.
  6. Tom ntej no, koj yuav txuas cov braid rau tus pin dawb ntawm lwm lub pob. Tab sis koj tseem yuav txuas lwm lub jumper hlau ntawm no, uas yuav ua rau hauv av. Npaj cov jumper hlau zoo li koj tau ua nrog lwm tus, suav nrog cov cua sov-ntsws tubing. Tam sim no khoov cov hlua kom koj tuaj yeem muab nws txuas rau tus pin dawb los ntawm lub khawm tig mus rau qhov kawg pub dawb. Tom qab ntawd txuas lub xov hlau jumper rau tus pin ib yam. Siv cov hlua khi los ntawm ib sab thiab cov xaim xaim xaim los ntawm lwm sab kom ntseeg tau tias koj tuaj yeem rub cov cua sov-ntsws tubing hla ib feem ntawm cov laug.
  7. Txuas plaub lub nyees khawm siv rau lub cav game los ntawm kev tsim cov choj me me. Ib txwm nco ntsoov rub cov cua sov-ntsws tubing hla cov braid ua ntej soldering. (Thiab tseem nco ntsoov tias koj cov nyees khawm nyob hauv txoj haujlwm raug ua ntej txuas lawv rau ib leeg). Thaum txuas lub pob kawg koj yuav tsum rov ua dua, ib yam li lwm ob lub nyees khawm, txuas cov hlua los ntawm hauv qab no thiab txuas lub xaim hlau txuas ib yam.
  8. Siv lub ntsuas cua lub suab ua haujlwm koj tuaj yeem tshawb xyuas yog tias txhua yam txuas nrog zoo. Thaum kawg koj yuav tsum txheeb xyuas yog tias tag nrho cov cua sov-ntsws tubing nyob hauv qhov chaw raug. Tom qab ntawd koj tuaj yeem siv lub teeb nrig lossis rab phom cua kub kom ua rau nws nqaim. Tam sim no koj tau ua tiav nrog sib dhos cov nyees khawm!

Kauj ruam 3: Teeb tsa Software

Teeb Software
Teeb Software

Koj yuav xav tau:

  • Raspberry Pi nrog Raspbian tau teeb tsa (koj yuav tsum tuaj yeem siv lwm qhov kev faib khoom ib yam nkaus, tab sis xav tau kho qee cov lus txib)-peb tau siv pob uas muaj xws li Raspberry Pi 3 Qauv B+ nrog rau daim npav SD ua ntej, lub hwj chim thiab ib rooj plaub, lwm cov qauv yuav tsum ua haujlwm ib yam nkaus
  • ib lub tshuab luam ntawv txais nyiaj - nco ntsoov tias koj yuav tsum txuas lub tshuab luam ntawv mus rau Raspberry Pi, yog li txuas ntawm USB yuav yooj yim dua
  • koj cov nyees khawm
  1. Txuas koj Raspberry Pi rau lub vijtsam, nas thiab keyboard. Koj tseem yuav xav txuas nws mus rau lub tshuab luam ntawv thiab cov nyees khawm thaum kawg. Cov nyees khawm yuav tsum txuas nrog rau GPIO tus pin tshwj xeeb. Yog tias koj xav siv tus pin sib txawv dua li peb tau ua, koj tuaj yeem hloov qhov ntawd hauv cov cai. Txog tam sim no, cov npe no yuav qhia koj tias lub pob twg xav tau txuas nrog tus pin twg. Kuv yuav siv tus lej BCM uas tseem siv hauv txoj cai. Muaj daim duab qhia ntawm https://www.raspberrypi.org/documentation/usage/g… qhia koj tus pin uas muaj tus lej twg.

    • khawm kaw - 17 • khawm rov pib dua - 27 • thawj khawm siv rau kev xaiv hauv zaj dab neeg/taug txuj kev nyuaj - 5 • khawm thib ob - 6 • khawm thib peb - 13 • khawm thib plaub - 19 • ob lub jumper xov txuas nrog cov pins uas koom nrog txhua cov nyees khawm yuav tsum tau mus rau hauv av - hauv kab ntawv cim los ntawm cov ntawv dub

    Pib Raspberry Pi los ntawm kev ntsaws lub hwj chim. Txuas Raspberry Pi mus rau is taws nem siv LAN cable lossis wireless network.

  2. Thawj qhov ua thaum txhim kho software tsim nyog ntawm raspberry pi yog hloov kho software uas twb tau teeb tsa lawm. Peb yuav ua qhov no siv lub davhlau ya nyob twg. Yog tias qhov no yog koj thawj zaug siv lub davhlau ya nyob twg, Raspberry Pi cov ntaub ntawv (https://www.raspberrypi.org/documentation/usage/terminal/) pab koj txav mus los thiab paub txog ib puag ncig. Qhib lub davhlau ya nyob twg thiab ntaus hauv sudo apt hloov tshiab thiab ntaus nkag. Qhov no yuav hloov kho daim ntawv teev cov pob khoom thiab cov hloov pauv. Tom qab ntawd, ntaus hauv sudo apt hloov tshiab. Qhov no yuav ua tiav qhov tshiab dua ntawm cov pob khoom tau teeb tsa.
  3. Txhim kho lub tshuab luam ntawv tsav tsheb yog cov kauj ruam tom ntej. Kev tswj tshuab luam ntawv hauv Linux tuaj yeem ua tiav siv CUPS. Koj yuav xav tau teeb tsa nws ntawm koj li Raspberry Pi ua ntej. Hauv lub davhlau ya nyob twg, ntaus hauv sudo apt nruab khob. Cov kauj ruam tom ntej yog kom tau txais lub tshuab luam ntawv tsav tsheb. Tej zaum koj tau txais hmoov zoo thiab nws tau suav nrog hauv cov chaw khaws cia raug cai. Hauv lub davhlau ya nyob twg, siv apt search [lub npe tshuab luam ntawv lossis lub npe chaw tsim khoom] txhawm rau nrhiav nws. Cov tshuab luam ntawv feem ntau yuav tsis suav nrog hauv cov chaw khaws khoom, yog li koj yuav tsum tau txais nws los ntawm lwm qhov. Tej zaum yuav muaj CD kaw rau ntawm lub tshuab luam ntawv. Hauv lub vev xaib ntawm cov chaw tsim khoom, cov tsav tsheb tshiab tshaj plaws yuav tsum muaj rau rub tawm. Qee cov chaw tsim khoom muaj cov vev xaib sib txawv rau thaj tsam sib txawv ntawm lub ntiaj teb thiab tu siab, tsis yog txhua tus ntawm lawv suav nrog tib cov ntaub ntawv. Yog tias koj muaj Lub Tshuab Luam Ntawv Star, starasia.com zoo li yog lub vev xaib nrog cov tsav tsheb rub tawm tshiab tshaj plaws. Thov txheeb xyuas tias koj rub cov tshuab luam ntawv rau Linux. Peb siv CUPS cov tsav tsheb, tsis yog JavaPOS cov tsav tsheb.
  4. Tom ntej no, koj yuav tsum teeb tsa cov tsav tsheb. Thov ua raws cov lus qhia ntawm cov chaw tsim khoom. Tej zaum yuav muaj phau ntawv qhia software rau Linux muaj, uas tuaj yeem ua ke. Thov ua raws cov lus qhia rau Debian lossis Ubuntu - muaj ntau qhov sib faib Linux sib txawv thiab tsis yog txhua yam zoo ib yam, yog li kos ua ntej, yog tias koj muaj cov lus qhia raug ntawm tes. Hauv peb phau ntawv qhia cov lus qhia pib yam tsis tau hais tias lawv yog rau Red Hat based systems thiab tsuas yog nyob rau nplooj ntawv tom ntej peb tau kawm, tias cov lus qhia rau Debian-based systems sib txawv. Phau ntawv software yuav tsum tau hais qhia tias pob ntawv twg yuav tsum tau teeb tsa, piv txwv li peb yuav tsum teeb tsa "libcups2-dev". Tej zaum koj yuav xav tau sudo qee cov lus txib. Txhawm rau txuag koj los ntawm kev rov ua peb qhov yuam kev: yog tias koj xav tau sau cov tsav tsheb los ntawm qhov chaws siv siv ua - tsim teeb tsa xav tau sudoed. Tsuas yog los ntawm cov lus yuam kev peb tsis tuaj yeem txheeb xyuas qhov ua tsis raug.
  5. Yog tias tsis suav nrog hauv koj phau ntawv teeb tsa koj yuav tsum teeb lub tshuab luam ntawv hauv CUPS. Txhawm rau ua qhov ntawd, mus rau localhost: 631 hauv qhov browser. Nyem rau ntawm "Administration" thiab tom qab ntawd "Ntxiv lub tshuab luam ntawv" los teeb lub tshuab luam ntawv. Kuj tseem muaj ntu pab. Koj yuav tsum txheeb xyuas qhov tseeb raws li tus neeg siv, saib https://help.ubuntu.com/lts/serverguide/cups.html… (ntu “Web Interface”) kom paub meej. Xaiv qhov tsim nyog ppd thiab ntawv loj. Koj kuj yuav tsum ua nws lub tshuab luam ntawv tsis raug, raws li lub software yuav luam tawm rau lub tshuab luam ntawv pib. Txhawm rau ua qhov ntawd, nkag mus rau nplooj ntawv ntawm lub tshuab luam ntawv thiab los ntawm "Kev Tswj Xyuas" cov ntawv qhia zaub mov xaiv "Teeb Raws Li Tus Neeg Siv Khoom Default". Los ntawm "Txij Nkawm" ntawv qhia zaub mov koj tuaj yeem xaiv "Luam Ntawv Nplooj Ntawv" rau thawj zaug yog tias txhua yam tau teeb tsa kom raug.
  6. Lwm pob uas koj yuav xav tau yog sej3-yaml, raws li cov dab neeg tau khaws tseg hauv yaml cov ntaub ntawv thiab pob ntawv xav tau yog li cov nab npawb nab npawb tuaj yeem txhais lawv. Siv sudo apt nruab python3-yaml rau nruab nws.
  7. Tam sim no peb yuav pib nrog kev teeb tsa software uas tau luam tawm cov dab neeg thiab mloog kom nkag tau rau ntawm GPIO pins txuas nrog cov nyees khawm. Qhib lub davhlau ya nyob twg thiab mus rau hauv phau ntawv qhia tsev yog tias koj tsis tau nyob hauv nws (qhov no tuaj yeem ua tiav los ntawm kev ntaus hauv cd (rau kev hloov pauv npe)). Raws li peb cov lej nyob ntawm GitHub, koj tuaj yeem luam nws rau koj Raspberry Pi los ntawm kev siv git clone https://github.com/fio-na/GrimmsKiste-1.git Qhov no yuav tsim lub chaw cia khoom hauv zos ntawm koj li Raspberry Pi ntawm peb cov cai. Yog tias koj tau txais cov lus yuam kev vim hais tias git tsis tau teeb tsa, koj tuaj yeem nruab nws los ntawm kev ntaus hauv sudo apt install git.
  8. Txoj cai muaj qee cov ntsiab lus uas koj yuav xav tau hloov. Ua ntej tshaj plaws, cov dab neeg tau khaws tseg hauv yaml cov ntaub ntawv uas tseem muaj nyob hauv git chaw cia khoom. Yog tias txoj hauv kev rau koj cov ntawv tsis yog "/home/pi/GrimmsKiste-1", koj yuav tsum hloov txoj hauv kev no txhawm rau siv cov dab neeg. Qhov thib ob, peb luam tawm siv cov txheej txheem qis thiab muab cov lus txib dav dav. Qhov no suav nrog qee qhov kev xaiv siv los ntawm peb lub tshuab luam ntawv uas tso cai rau peb txiav txim siab tias daim ntawv yuav raug txiav tom qab luam ntawv lossis tsis. Cov no tej zaum yuav tsis ua haujlwm rau koj (tshwj tsis yog koj tseem siv Lub Tshuab TSP Lub Hnub Qub). Koj tseem yuav pom tias tus lej kab tsuas suav nrog ib tus kab ntawv yuav luam tawm. Peb xav tau qhov no, vim tias qee qhov ntawm zaj dab neeg tsis tuaj yeem nyeem tau vim tias daim ntawv tseem nyob hauv lub tshuab luam ntawv. Thiab thaum kawg hauv kev ua haujlwm format_text peb siv cov ntawv sau kom tau cov ntu ntawm cov ntawv tsis ntev dua 28 tus cim, vim tias muaj pes tsawg tus haum rau ib kab ntawm peb daim ntawv 80 hli. Thov hloov cov khoom no kom haum rau koj teeb tsa.
  9. Qee cov ntaub ntawv yuav tsum tau ua kom tiav. Txhawm rau ua qhov no, nkag mus rau hauv daim nplaub tshev nrog cov lej koj nyuam qhuav rub tawm. Qhov no yuav tsum yog cd ~/GrimmsKiste-1 yog tias koj ua raws. Hauv Linux cov ntawv tso cai tau ua los ntawm chmod. chmod a+x Engin.py thiab chmod a+x shutdown-pi-and-restart-program.py ua rau ob daim ntawv ua tiav rau txhua tus neeg siv.
  10. Tam sim no peb tuaj yeem ntsuas yog tias lub cav tuaj yeem ua haujlwm thiab ua haujlwm tau zoo thiab yog tias lub tshuab luam ntawv thiab khawm tau teeb tsa raug. Ntaus hauv./Engin.py los ua qhov ntawd.
  11. Yog tias txhua yam ua haujlwm tau zoo, cov kauj ruam tom ntej yog teeb tsa ob qhov systemd cov kev pabcuam. Yog xav paub ntxiv, nplooj ntawv archlinux wiki (https://wiki.archlinux.org/index.php/Systemd) tuaj yeem pab lossis nplooj ntawv txiv neej ntawm systemd.service (https://www.freedesktop.org/software/systemd/ txiv neej/systemd.service.html). Thawj qhov kev pabcuam systemd yuav tshuaj xyuas txhua ob vib nas this, yog tias Engin.py tab tom tab tom khiav, thiab yog tias nws tsis yog nws yuav pib nws. Yog li nws tseem pib qhov haujlwm thaum Raspberry Pi khau raj. Qhib cov ntaub ntawv hauv kab ntawv systemd: sudo nano /etc/systemd/system/grimmskiste-restart.service Ntaus hauv qab no:
  12. [Chav]

    Nqe lus piav qhia = rov pib dua Grimms Kiste txhua ob vib nas this yog tias nws ua tsis tau [Kev Pabcuam] ExecStart =/home/pi/GrimmsKiste-1/Engin.py Restart = ib txwm RestartSec = 2 [Nruab Nrab] WantedBy = ntau-user.target

  13. Koj yuav tsum hloov kho txoj hauv kev ExecStart, yog tias koj li Engin.py nyob lwm qhov, piv txwv li. yog tias koj lub npe siv sib txawv. Txhawm rau khaws cov ntaub ntawv hauv nano, koj yuav tsum thawb ctrl + x, tom qab ntawv ntaus y (rau yog) thiab ntaus nkag.
  14. Lwm qhov kev pabcuam yuav pib kaw -pi-and-restart-program.py tsab ntawv, uas mloog thaum kaw thiab rov pib dua. Lub pob pib dua nyeem cov txheej txheem ID ntawm Engin.py los ntawm cov ntaub ntawv thiab tua nws, thiab vim yog lwm qhov systemd pabcuam Engin.py rov pib dua tom qab ob vib nas this. Lub kaw lus kaw yooj yim xa cov lus txib mus rau Raspberry Pi uas yuav tsum tau kaw tam sim no. Qhib lwm cov ntaub ntawv siv sudo nano /etc/systemd/system/grimmskiste.service thiab ntaus hauv qab no:
  15. [Chav]

    Nqe lus piav qhia = Tswj ob lub khawm khoos phis tawj kom kaw raspberry pi lossis tua txoj haujlwm khiav Grimms Kiste [Kev pabcuam] ExecStart =/home/pi/GrimmsKiste-1/shutdown-pi-and-restart-program.py [Install] WantedBy = multi-user.target

  16. Ib zaug ntxiv, koj yuav tsum tau kho txoj hauv kev ntawm ExecStart, yog tias nws txawv ntawm koj Pi. Thiab dua, koj tuaj yeem txuag cov ntawv hauv nano siv ctrl + x, tom qab ntawv y y thiab ntaus nkag.
  17. Tam sim no koj muaj cov ntawv hauv chav rau cov kev pabcuam systemd, tabsis lawv tseem tsis tau siv. Thaum twg los xij koj hloov cov ntawv hauv chav, ntaus hauv sudo systemctl daemon-reload, yog li ua tam sim no. Tom qab ntawd pib ob qho kev pabcuam siv sudo systemctl pib grimmskiste.service thiab sudo systemctl pib grimmskiste-restart.service Qhov no yuav pib cov kev pabcuam tam sim no. Siv sudo systemctl xwm txheej grimmskiste.service thiab sudo systemctl xwm txheej grimmskiste-restart.service los tshuaj xyuas yog tias lawv tau nce thiab khiav. Hauv qhov tso tawm, yuav tsum muaj kab uas suav nrog "nquag (khiav)", tej zaum hauv kab thib peb - yog tias tsis yog, muaj qee yam tsis raug. Journalctl yuav tuaj yeem pab nrog cov ntaub ntawv debugging ntau dua.
  18. Kev siv systemctl pib tsuas yog pib cov kev pabcuam rau tam sim no, tab sis yog tias koj xav kom lawv pib txhua lub sijhawm Raspberry Pi khau raj, koj yuav tsum ua kom lawv. Qhov no ua tiav los ntawm sudo systemctl pab grimmskiste.service thiab sudo systemctl pab grimmskiste-restart.service.
  19. Tam sim no koj yuav tsum ntsuas txhua cov nyees khawm yog tias txhua yam ua haujlwm raug. Kuaj lub khawm kaw ib yam thiab tshawb xyuas yog tias txhua yam tseem ua haujlwm zoo tom qab rov pib dua. Yog li, koj tsis xav tau lub vijtsam, keyboard thiab lwm yam thiab koj cov haujlwm yuav tsum ua haujlwm txhua lub sijhawm koj ntsaws Raspberry Pi rau hauv lub qhov (socket).

Kauj Ruam 4: Qhia rau YAML:

Taw qhia rau YAML
Taw qhia rau YAML
Taw qhia rau YAML
Taw qhia rau YAML
Taw qhia rau YAML
Taw qhia rau YAML
Taw qhia rau YAML
Taw qhia rau YAML

Tseem ceeb: Cov teb hauv ntshav yuav tsum tsis txhob hloov npe. Cov npe ntawm cov npe ib leeg yog kev zam. Txhua zaj dab neeg tau txais nws tus kheej YAML cov ntaub ntawv nrog txhua qhov kev xaiv. Tus qauv yog tib yam li rau cov ntaub ntawv start.yaml

Colon: Yog tias koj xav siv cov kab lus hauv kab lus koj yuav tsum ua> tom qab cov lus. Tom qab ntawv cov ntawv tau qis dua ib kab thiab nkag mus nrog ob kab dawb paug.

Tabs: Tsis txhob siv tabs thiab thov nco ntsoov tias tsis muaj tabs thaum kawg ntawm cov lus, qhov no yuav ua rau tus parser tsis tuaj yeem nyeem cov ntawv.

_default_question: Cov lus nug nkag los ntawm no yog siv yog tias tsis muaj qhov teb nrog "lo lus nug" tau nkag mus rau hauv keeb kwm.

_prompt: Daim teb no tau luam tawm thaum tus nyeem ntawv yuav tsum nkag mus.

Ob daim teb tsuas yog muaj nyob ib zaug hauv cov ntawv start.yaml thiab yuav tsis siv rau lwm cov ntaub ntawv.

pib: pib yog lub npe ntawm thawj cov npe ntawm nplooj ntawv pib. Cov npe yuav tsum tsis txhob theej tawm hauv txhua lwm cov npe. Hauv tus qauv, daim teb no hu ua „Lub npe ntawm zaj dab neeg thiab yuav tsum tau hloov pauv rau txhua zaj dab neeg.

Lus Qhia: Daim teb no muaj zaj dab neeg thiab yuav tsum sawv hauv ib kab. lo lus nug: Siv thaum cov lus nug uas tsis yog _default_question yuav raug siv. Yog tias daim teb tsis siv, nws yuav tsum raug tshem tawm. (yeem)

Kev Ua: Cov npe "ua" muaj cov kev xaiv xaiv. Qhov siab tshaj ntawm 4 qhov kev xaiv tuaj yeem nkag rau ntawm no. Label: Daim ntawv lo tau luam tawm raws li kev xaiv.

Tom ntej: Nov yog lub npe ntawm qhov kev xaiv xaiv tom ntej uas yuav raug hu.

kawg: Ib daim ntawv uas muaj cov lus tsuas yog hais txog qhov kawg ntawm zaj dab neeg

Ntxiv dab neeg ntxiv:

Raws li tau piav qhia saum toj no, txhua zaj dab neeg tshiab tau txais nws tus kheej.yaml cov ntaub ntawv. Txhawm rau ua qhov no, qhib daim nplaub tshev "Grimms Box" thiab luam cov ntawv template.yaml. Koj tuaj yeem pom nws hauv peb GitHub repo (https://github.com/fio-na/GrimmsKiste-1). lub npe ntawm zaj dab neeg thiab qhib nws. Hauv cov ntawv tshiab koj ntxiv cov chaw tsim khoom thiab hnub tim thiab hloov daim teb "Lub npe ntawm zaj dab neeg" rau lub npe (saib daim duab 4: Lub npe ntawm zaj dab neeg ntawm no yog HP1). Tom qab ntawd sau cov lus, lo lus nug, daim ntawv lo thiab tom ntej. Thaum koj tau ua tiav qhov no, theej cov ntaub ntawv qauv (raws li qhia hauv daim duab 4) thiab muab nws tso rau hauv qab qhov kawg tom ntej. Tam sim no lub npe yuav raug hloov mus rau ib qho tseem ceeb siv hauv "tom ntej" hauv thawj ntu (raws li qhia hauv daim duab. 4 HP1 yuav yog HP2 lossis gang2, nyob ntawm seb qhov kev xaiv twg raug kho ua ntej). Tom qab ntawv, cov lus nug, daim ntawv lo thiab tom ntej no tau rov sau dua. Ua qhov no rau txhua qhov kev xaiv/ua kom txog thaum tag nrho zaj dab neeg nyob hauv cov ntawv. Txhua qhov kawg daim ntawv teev npe kawg yuav tsum muaj cov lus nkaus xwb. Tag nrho lwm thaj chaw hauv daim ntawv kawg yuav tsum raug tshem tawm. Tom qab ntawv cov ntawv yuav tsum raug cawm.

Cov txheej txheem luv:

  1. Qhib lub Grimms Box nplaub tshev
  2. Luam Vorlage.yaml thiab hloov nws mus rau lub npe ntawm zaj dab neeg.
  3. Qhib cov ntawv tshiab no.
  4. Luam cov qauv ntaub ntawv (daim duab 4)
  5. Hloov lub npe los ntawm Keeb Kwm rau Xaiv lub npe
  6. Sau cov lus ntawm zaj dab neeg hauv kab lus,
  7. Ntxig daim ntawv tsim nyog.
  8. Sau lub npe ntawm qhov kev xaiv xaiv tom ntej hauv tom ntej.
  9. Rov ua cov kauj ruam 4 txog 9 kom txog thaum zaj dab neeg tiav.
  10. Txhua qhov xaus: Daim ntawv teev npe kawg tsuas muaj cov lus xwb.
  11. Txuag cov ntawv.

Ntxiv koj zaj dab neeg tshiab rau nplooj ntawv pib:

start.yaml yog nplooj ntawv pib rau Grimm lub npov. Txawm li cas los xij, cov ntawv no yuav tsum xub muaj peev xwm nkag mus rau cov dab neeg tshiab. Yog li ntawd, cov dab neeg tshiab yuav tsum muab ntxiv rau hauv cov ntawv no ua ntej.

Ib qhov kev ua koj tsuas tuaj yeem tsim 4 daim ntawv lo, tom ntej, vim tias Grimm lub thawv tsuas muaj 4 lub nyees khawm xaiv los ntawm. Yog li ntawd, yog, zoo li hauv qhov piv txwv pib.yaml cov ntaub ntawv, 4 daim ntawv lo thiab cov haujlwm tom ntej tau raug xaiv lawm, daim ntawv thib 4 yuav tsum muaj npe "Ntau zaj dab neeg" lossis "Ntau" thiab cov ntaub ntawv thib ob (ntawm no: S2; nrog cov lus, lus nug, kev nqis tes ua, daim ntawv cim npe, tom ntej) yuav tsum txuas ntxiv thiab hloov npe. Tom qab ntawd koj ntxiv zaj dab neeg tshiab nrog daim ntawv lo thiab tom ntej thiab npe nws kom tsim nyog. Thaum kawg, nws yuav tsum tau txais kev cawmdim.

Cov txheej txheem luv:

Hauv start.yaml:

  1. Qhib start.yaml
  2. Sau cov teb kom tsim nyog.
  3. Cov haujlwm, daim ntawv lo thiab tom ntej yuav tsum tau theej thiab muab tshuaj txhuam.
  4. Txuag.

Khaws cov ntaub ntawv tseem ceeb "Engin.py":

Thaum kawg, zaj dab neeg yuav tsum tau ntxiv rau cov ntaub ntawv tseem ceeb "Engin.py". Rau qhov no tsuas yog txoj hauv kev ntawm cov ntaub ntawv YAML tshiab yuav tsum tau nkag mus rau hauv cov ntawv teev npe. ib comma.

Cov txheej txheem luv:

  1. Qhib Engine.py.
  2. Luam cov kab ntawv ntawm YAML cov ntawv
  3. Luam kab rau filelist
  4. Cais txoj hauv kev los ntawm tus lej.

Kauj Ruam 5: Cov Lus Qhia rau Kev Siv

Cov Lus Qhia rau Kev Siv
Cov Lus Qhia rau Kev Siv

Txhawm rau pib Grimm's Box, txuas lub tshuab luam ntawv mus rau Raspberry Pi (muaj qhov me me rau cov hlua), ntsaws lub tshuab luam ntawv thiab Raspberry Pi rau hauv lub qhov (socket) thiab tig lub tshuab luam ntawv. Raspberry Pi pib ntawm nws tus kheej thaum ntsaws rau hauv. Tos nws kom khau raj. Lub software yuav tsum pib ntawm nws tus kheej.

Muaj lub pob kaw lub Raspberry Pi thiab khawm kom rov pib dua zaj dab neeg software, yog tias ib tus neeg tsuas yog tawm mus yam tsis tau xaus zaj dab neeg. Ob leeg yuav tsum tau thawb yam tsawg 3 vib nas this. Qhov no yog txhawm rau xyuas kom lawv tsis raug thawb yuam kev tab sis koj tuaj yeem hloov lub sijhawm nyob rau hauv kaw -pi-and-restart-program.py cov ntaub ntawv. Thov siv khawm kaw, tsuas yog ntsaws tsis zoo rau Raspberry Pi. Nrog rau kev teeb tsa tam sim no koj tsis tuaj yeem pom tias Raspberry Pi nyob lossis tawm yog li koj yuav tsum tau txheeb xyuas yog tias nws tseem ua rau lwm cov nyees khawm yog tias koj xav paub tseeb.

Rov pib dua qhov haujlwm yuav siv sijhawm me ntsis, vim tias koj xav tau thawb lub khawm tsawg kawg 3 vib nas this thiab cov txheej txheem hauv keeb kwm yav dhau tsuas yog kuaj xyuas txhua 2 vib nas this yog tias txoj haujlwm tau ua, yog li cov txheej txheem tag nrho kom txog thaum nws rov luam tau tuaj yeem siv sijhawm 6 vib nas this. Tsuas yog muab sijhawm me ntsis. Lub pob pib dua tuaj yeem siv tau, yog tias muaj teeb meem tshwm sim. Tej zaum kev rov pib dua tuaj yeem kho nws. Yog tias nws tsis yog, txuas Raspberry Pi mus rau lub vijtsam thiab lwm yam thiab khiav cov haujlwm los ntawm lub davhlau ya nyob twg tuaj yeem tsim cov lus yuam kev koj tuaj yeem saib hauv internet. Cov nyees khawm uas siv rau cov dab neeg yuav tsum tau thawb yam tsawg 0.1 vib nas this, tab sis nws tsis tshua muaj neeg uas thawb lawv tsawg dua li ntawd.

Yog tias zaj dab neeg tiav, daim ntawv raug txiav thiab txoj haujlwm pib dua ib zaug. Tab sis kom muab tus nyeem qee lub sijhawm los nyeem qhov kawg nws tos 3.5 vib nas this ntxiv rau 2 vib nas this xav tau kom pom tias qhov haujlwm tsis ua haujlwm thiab rov pib dua. 3.5 vib nas this tuaj yeem kho tau hauv Engin.py cov ntaub ntawv.

Cov nyees khawm thawb tsawg dua 1.7 vib nas this tom qab lub laub zaum kawg yuav tsis txais. Peb tau siv qhov no vim tias Raspberry Pi tau nrawm dua lub tshuab luam ntawv thiab thawb ob lub nyees khawm yuav ua rau qhov kev txiav txim raug xaiv ua ntej tus nyeem ntawv tuaj yeem pom cov kev xaiv.

Pom zoo: