Cov txheej txheem:

Lub Hnub Qub Wars Lub Teeb Nrog Circuit Chaw Ua Si Qhia: 5 Kauj Ruam
Lub Hnub Qub Wars Lub Teeb Nrog Circuit Chaw Ua Si Qhia: 5 Kauj Ruam

Video: Lub Hnub Qub Wars Lub Teeb Nrog Circuit Chaw Ua Si Qhia: 5 Kauj Ruam

Video: Lub Hnub Qub Wars Lub Teeb Nrog Circuit Chaw Ua Si Qhia: 5 Kauj Ruam
Video: niam tais vab part4 10/4/2018 2024, Hlis ntuj nqeg
Anonim
Image
Image

Lub teeb no siv Circuit Playground Express los ua lub teeb thiab cov nkauj ua ntu zus. Cov ntawv sib txuas sib txuas tig ntawm lub teeb pom kev sib cais thiab ua si ib qho Lub Imperial Lub Peb Hlis (Darth Vader lub ntsiab lus) lossis Lub Ntsiab Tseem Ceeb los ntawm Star Wars. Txoj cai program suav nrog hauv qhov kev qhia no tuaj yeem hloov pauv los ua ib qho qhab nia suab paj nruag thiab ntxiv cov ntaub qhwv tuaj yeem txuas ntxiv los ua suab ntxiv/teeb ntxiv.

Khoom siv

  • Circuit Court Chaw Ua Si Qhia
  • MakeCode online programming platform
  • Haus tau
  • Riam tseeb
  • Pliers
  • Sharpie
  • Rub cawv thiab ntawv phuam
  • Xaws koob (los yog awl)
  • 4 aligator clips
  • Tus neeg hais lus sab nraud nrog lub taub hau-xov tooj
  • 2 npib tsib xee (los yog daim tooj liab)
  • Cov khoom siv rau lub hauv paus (yeem)

Kauj Ruam 1: Kauj Ruam 1: Tsim Koj Li Code

Kauj ruam 1: Tsim Koj Cov Cai
Kauj ruam 1: Tsim Koj Cov Cai
Kauj ruam 1: Tsim Koj Cov Cai
Kauj ruam 1: Tsim Koj Cov Cai

Txhawm rau pib, qhib Adafruit's MakeCode online platform thiab pib qhov haujlwm tshiab.

Tsim qhov "pib" thaiv thiab teeb tsa lub sijhawm rau 30 (saib duab 1). Teem lub hue los ntawm kev mus rau Javascript thiab ntxiv "cia hue = 0" (saib duab 3).

Thawj ntu ntawm cov cai yuav ua rau thawj lub teeb ua ntu zus. Txhawm rau pib, tsim lub voj ib txhis thiab tsim qhov xwm txheej thaiv "yog qhov tseeb, tom qab ntawd" hauv lub voj. Hloov "qhov tseeb" rau "thaum _ raug nias" los ntawm ntu ntu ntu ("kov A2" tau siv hauv cov cai no txhawm rau tso cai rau kov lub ntsej muag tab sis koj tseem tuaj yeem xaiv A lossis B khawm yog tias koj tsis xav tau ib lub sensor txuas los pib qhov haujlwm). (saib duab 2)

Mus txuas ntxiv tsim cov cai raws li pom hauv daim duab 2. Tsim kom muaj qhov hloov pauv tshiab "hue" txhawm rau hloov cov xim hauv lub teeb ua ntu zus. Tsim qhov hloov pauv tshiab (ntawm no nws hu ua "j") txhawm rau tso cai cov xim hloov pauv mus rau ib puag ncig ntawm txhua lub LEDs (qhov twg 0 yog koj lub teeb pom kev thawj zaug thiab 9 yog lub teeb kawg nyob rau hauv ntu). Ncua ncua ntxiv kom tso cai rau koj pom cov teeb pom kev hloov zuj zus. Cov thaiv kev xaiv coding tsuas yog tso cai rau kev ncua kom luv li 100ms. Yog tias koj xav kom ncua sijhawm luv dua, koj yuav tsum hloov kho lub sijhawm siv Javascript nyob rau hauv kab lus tom qab "ncua" (saib duab 3). Siv "set_ to_" thiab ntxig rau "hue" sib txawv thiab ua lej. Kev ua lej yuav tso cai rau koj txiav txim siab hloov pauv hue sai npaum li cas (qhov no tau teeb tsa los ntawm tus lej 2 hauv tus lej piv txwv) thiab ntau npaum li cas hues lub teeb ua ntu zus yuav siv (ntawm no nws tau teeb tsa 30 kom cov hues nyob hauv liab, txiv kab ntxwv, thiab daj tab sis yog tias nws tau teeb tsa 255, lub teeb yuav tig los ntawm zaj sawv). Ua kom ntseeg tau tias lub teeb sib xws nyob hauv ib qho "khiav hauv qhov sib luag" thaiv kom ntseeg tau tias nws yuav ua si ib txhij nrog lub suab sib lawv liag.

Qhov thib ob ntawm cov cai yuav tsim cov suab sib dhos ua ke. Txhawm rau tsim lub suab ua ntu zus, tsim kab lus "ua suab nrov ntawm _ rau _ yeej" thiab ntxig cov ntawv thiab ntaus qhov ntev raws li cov qhab nia suab paj nruag yooj yim rau Lub Peb Hlis Imperial (saib duab 4). Xaus qhov thib ob ntawm cov cai nrog cov lus txib kom tso tseg cov duab thaum lwm lub cim (ntawm no nws "kov A3") raug nias. Qhov no yuav ua kom ntseeg tau tias thawj lub teeb pom kev zoo yuav tsis txuas ntxiv mus rau lub teeb pom kev thib ob.

Txog qhov teeb pom kev thib ob, theej tawm thawj lub teeb pom kev zoo lub cim. Hloov "kov A2" mus rau "kov A3" (qhov no yog lwm qhov kev ntsuas ntawm lub Chaw Ua Si Circuit Court Express). Teem cov pixels rau xiav thiab hloov cov lej hauv cov lej ua lej kom muaj cov xim nyob hauv thaj tsam xiav thiab xiav-ntshav (saib duab 6). Nkag mus rau Javascript thiab kho lub sijhawm ncua. Hauv Javascript ntxiv cov kab lus "hue = Colors. Green" kom paub tseeb tias qhov hue ntau nyob hauv qhov xiav (saib duab 7).

Saib daim duab 8 kom ua tiav lub suab thib ob (saib duab 9 rau cov qhab nia suab paj nruag). Nco ntsoov suav nrog "nres txhua qhov ua yeeb yaj kiab" thaum kov A2 raug nias kom ntseeg tau tias qhov kev ua yeeb yaj kiab thib ob yuav tsis ua si thawj zaug thaum hloov ntawm ob.

Kauj Ruam 2: Kauj Ruam 2: Nqa Tus Hais Lus Sab Nraud (xaiv tau)

Kauj Ruam 2: Nqa Tus Hais Lus Sab Nraud (xaiv tau)
Kauj Ruam 2: Nqa Tus Hais Lus Sab Nraud (xaiv tau)

Siv ob tus nab kuab txuas los txuas rau Circuit Playground Express rau tus hais lus sab nraud. Lub rooj tsavxwm muaj nws tus kheej hais lus tab sis nws yuav ua suab nkauj ua ntu zus ntsiag to. Txuas ib qho kawg ntawm tus nab kuab clip rau hauv av (GRD) qhov thiab lwm qhov kawg rau tus hais lus nkaus. Txuas ib qho kawg ntawm tus yeeb yaj kiab thib ob rau tus A0 qhov thiab lwm qhov kawg rau tib tus neeg hais lus nkaus (saib duab).

Kauj Ruam 3: Kauj Ruam 3: Teem Teem Kov Sensors

Txuas ib qho kawg ntawm tus kais dej rau tus A2 qhov thiab txuas lwm qhov kawg rau npib tsib xee (lossis daim tooj liab).

Txuas ib kawg ntawm tus nab kuab thib ob rau hauv lub qhov A3 thiab txuas lwm qhov kawg rau ob lub npib tsib xee (lossis daim tooj liab).

Thaum qhov haujlwm ua haujlwm, txhua lub npib tsib xee yuav ua tus kov kov uas yuav pib lawv cov teeb pom kev zoo sib xws thiab cov nkauj ua ntu zus.

Kauj Ruam 4: Kauj Ruam 4: Ua Lub Teeb

Kauj Ruam 4: Ua Lub Teeb
Kauj Ruam 4: Ua Lub Teeb
Kauj Ruam 4: Ua Lub Teeb
Kauj Ruam 4: Ua Lub Teeb
Kauj Ruam 4: Ua Lub Teeb
Kauj Ruam 4: Ua Lub Teeb

Txhawm rau ua lub thawv rau lub teeb, pib nrog lub tuaj ntxuav tawm (saib duab 1).

Ua tib zoo txiav tawm qhov kawg ntawm qhov tuaj yeem siv rab riam uas siv tau (saib duab 2). Qhov no yuav tawm ntawm lub ntsej muag ntse. Siv ob rab phom, khoov qhov txiav ntug thiab ua rau hauv lub raj mis. Qhov no yuav tsim ib qib, tsis-jagged ntug (saib duab 3).

Kos tus qauv tsim mus rau lub peev xwm siv Sharpie. Kev tsim qauv yuav tsum tau taw qhia kom lub hauv qab ntawm lub peev xwm (qhov kawg tsis txiav tawm) yog nyob rau sab saum toj. Qhov kev tsim qauv no siv daim duab yooj yim ntawm R2D2 (saib cov duab 4 & 5). Thaum koj tus qauv tsim kos rau, siv rab koob xaws lossis awl txhawm rau khawb qhov raws koj cov kab kos. Nco ntsoov tso lawv nrug deb me me (saib duab 6). Thaum koj ua tiav qhov xaum lub qhov rau hauv koj lub peev xwm, siv daim ntawv so tes thiab cov dej cawv me me los tshem tawm cov cim Sharpie.

Yog tias koj xav tsim lub hauv paus, xaiv cov khoom siv thiab taug ib puag ncig ntawm lub peev xwm txiav qhov kawg. Txiav tawm lub voj voog uas qhov kev taug qab tau tsim (saib duab 7). Muab qhov qhib qhov kawg ntawm lub kaus poom tso rau hauv lub hauv paus. Tam sim no qhov no tuaj yeem tso rau ntawm koj qhov Circuit Court Playground Express (saib duab 8).

Kauj Ruam 5: Kauj Ruam 5: Qhib Lub Teeb

Thaum lub thawv teeb dhau ntawm koj qhov Circuit Court Playground Express, koj tuaj yeem tig koj lub rooj tsavxwm thiab tus hais lus sab nraud. Kov cov npib tsib xee yuav tsum pib koj cov cai. Yog tias qee yam tsis ua si kom raug, tshawb xyuas kom paub tseeb tias koj cov yeeb yaj kiab cov yeeb yaj kiab raug kaw kom raug.

Pom zoo: