Cov txheej txheem:

[2020] Teeb Teeb LEDs rau Crawling Hmo Ntuj: 9 Cov Kauj Ruam (nrog Duab)
[2020] Teeb Teeb LEDs rau Crawling Hmo Ntuj: 9 Cov Kauj Ruam (nrog Duab)

Video: [2020] Teeb Teeb LEDs rau Crawling Hmo Ntuj: 9 Cov Kauj Ruam (nrog Duab)

Video: [2020] Teeb Teeb LEDs rau Crawling Hmo Ntuj: 9 Cov Kauj Ruam (nrog Duab)
Video: Things Mr. Welch is No Longer Allowed to do in a RPG #1-2450 Reading Compilation 2024, Hlis ntuj nqeg
Anonim
[2020] Teeb LEDs rau Hmo Ntuj Cuam
[2020] Teeb LEDs rau Hmo Ntuj Cuam

Valenta tawm-Roader

Valenta Off-Roader yog Micro: me ntsis powered Off-Road RC tsheb. Nws yog Lego Technic sib xws thiab nruab nrog ob (x2) micro iav motors ntawm lub log tsheb tom ntej thiab (x1) lub tog raj kheej servo raws li Roberval caj npab mechanism. Humming Works LLC thiab 4Tronix UK tab tom ua haujlwm koom tes tsim qauv Valenta Off-Roader.

"Night Crawler" version

Qhov hloov tshiab tau los nrog cov x4 LEDs tsim rau hmo ntuj nkag! Siv Microsoft MakeCode tus khoos phis tawj thiab Valenta txuas ntxiv, koj tuaj yeem teeb tsa ntau yam teeb pom kev zoo LED, ntev thiab RGB xim! Kho koj lub tsheb thiab teeb pom kev zoo!

Khoom siv

Thov ua kom tiav cov haujlwm no ua ntej nkag mus rau qhov haujlwm no.

Sib dhos Phau Ntawv Qhia rau Valenta Off-Roader

Siv IPhone lossis IPad thiab Micro: ntsis Game Pad App los tswj lub tsheb RC

Hmoov zoo thiab muaj kev lom zem!

Kauj Ruam 1: Luam Cov Qauv Ua Qauv

Luam theej cov ntawv ua piv txwv
Luam theej cov ntawv ua piv txwv
Luam theej duab Cov Qauv Ua Qauv
Luam theej duab Cov Qauv Ua Qauv

Txog qhov haujlwm no, peb tau npaj cov qauv ua piv txwv MakeCode (Receiver.hex) yog li koj tuaj yeem rub tawm. Txij li cov qauv ntawv tau npaj ua si, koj tuaj yeem pib ua si tam sim ntawd.

Hauv qib no, koj tuaj yeem rub cov ntawv ua piv txwv rau koj lub khoos phis tawj. Txuas koj lub khoos phis tawj thiab micro: me ntsis ntawm USB cable. Luag thiab xa cov ntawv ua piv txwv mus rau micro: ntsis thiab siv qhov no ua "tus txais" micro: me ntsis.

Thaum koj tau theej cov ntawv ua piv txwv mus rau micro: me ntsis, txuas nws los ntawm koj lub computer. Tom qab ntawd, teeb tsa lub micro: me ntsis ntawm Valenta Off-Roader thiab qhib lub zog hloov pauv ntawm lub cav tswj.

Kauj Ruam 2: Teeb Micro: ntsis IOS GamePad App

Teeb Micro: me ntsis IOS GamePad App
Teeb Micro: me ntsis IOS GamePad App
Teeb Micro: me ntsis IOS GamePad App
Teeb Micro: me ntsis IOS GamePad App

Txhawm rau txhim kho micro: ntsis iOS App ntawm koj iPhone lossis iPad, ua ke lub app rau micro: ntsis thiab teeb tsa Game Pad, thov xa mus rau qhov haujlwm "Siv IPhone lossis IPad thiab Micro: ntsis Game Pad App los tswj lub tsheb RC "thoob plaws theem 2 txog 12. Hauv qhov haujlwm yav dhau los no, peb tau muab Game Pad khawm A txog D rau hauv cov hauv qab no:

  • Nias lub khawm A -> Lub tsheb mus tom ntej
  • Nias khawm B -> Lub tsheb rov qab
  • Nias lub khawm C -> Lub tsheb tig laug
  • Nias khawm D -> Lub tsheb tig mus sab xis

Txhawm rau txoj haujlwm no qhib thiab tua LEDs, vim li cas peb thiaj tsis muab Game Game khawm 1 thiab 2 raws li hauv qab no:

  • Nias lub khawm 1 -> Qhib lub teeb LED
  • Nias lub khawm 2 -> Tua lub teeb LED

Kauj Ruam 3: Txheeb Xyuas MakeCode Cov Qauv Qauv

Txheeb xyuas cov MakeCode Sample File
Txheeb xyuas cov MakeCode Sample File
Txheeb xyuas cov MakeCode Sample File
Txheeb xyuas cov MakeCode Sample File
Txheeb xyuas cov MakeCode Sample File
Txheeb xyuas cov MakeCode Sample File

Tam sim no cia peb tshuaj xyuas seb cov lej thaiv yuav ua haujlwm zoo li cas hauv MakeCode cov ntaub ntawv no.

Hauv cov kauj ruam ua ntej, koj tau rub tawm MakeCode cov qauv ua piv txwv rau koj lub khoos phis tawj. Txuas koj lub khoos phis tawj thiab micro: me ntsis ntawm USB cable. Qhib MakeCode editor thiab nyem Ntshuam khawm. Qhib Receiver.hex cov ntaub ntawv uas koj tau theej rau "txais" micro: me ntsis.

Kauj Ruam 4: Ntxiv Valenta txuas ntxiv rau MakeCode Editor

Ntxiv Valenta Extensions rau MakeCode Editor
Ntxiv Valenta Extensions rau MakeCode Editor
Ntxiv Valenta Extensions rau MakeCode Editor
Ntxiv Valenta Extensions rau MakeCode Editor
Ntxiv Valenta Extensions rau MakeCode Editor
Ntxiv Valenta Extensions rau MakeCode Editor

Txhawm rau kom pom cov LED hauv txoj haujlwm no, koj yuav tsum ntxiv Valenta txuas ntxiv mus rau MakeCode tus kho kom raug. Lawv yog ib qho yooj yim-rau-siv cov txheej txheem ua ntej ntawm cov lej peb tau tsim tshwj xeeb rau kev ua si nrog Valenta Off-Roader.

Nyem Extensions hauv qab ntawm cov ntawv qhia zaub mov. Ntaus https://github.com/4Tronix/Valenta hauv lub npov tshawb nrhiav, raws li qhia hauv daim duab txuas. Nyem qhov txuas ntxiv ntawm Valenta. Tam sim no qhov txuas ntxiv tau ntxiv hauv cov ntawv qhia zaub mov. Cia peb siv cov kev txuas ntxiv hauv qab no hauv qhov haujlwm no.

Pawg Qauv Qauv Cov pawg no tau siv feem ntau thaum koj pib ua lej thaum pib thaiv. Hauv txoj haujlwm no los teeb LEDs ntawm koj Valenta Off-Roader, koj yuav siv Valenta Zero lub cev muaj zog tswj nrog rau hauv cov khoom siv. Koj yuav luag thiab poob xaiv pawg thawj coj qauv Zero block nyob rau ntawm qhov pib thaiv, yog li "tus txais" micro: me ntsis tuaj yeem lees paub tias lub cav tswj hwm twg yuav siv rau txoj haujlwm no.

FireLed thaiv

Yog tias koj saib Valenta Zero lub cev muaj zog tswj ntawm lub tsheb, nws muaj x4 LEDs tus lej 0, 1, 2 thiab 3. Pawg neeg thaiv no yuav ua kom pom cov LED no ntau txoj hauv kev. Piv txwv li, koj tuaj yeem khaws koj cov xim nyiam (lossis txheeb xyuas ib qho xim RGB uas koj nyiam), teeb lub sijhawm teeb pom kev zoo thiab kho nws qhov ci ci raws li qhov koj nyiam.

Kauj Ruam 5: Rov Siv Tus "Qub" Thaiv Cov Cai Peb Tau Ua

Rov siv dua
Rov siv dua

Hauv cov kauj ruam dhau los, koj tau qhib Cov Ntaub Ntawv Receiver.hex theej rau "txais" micro: me ntsis hauv MakeCode editor. Tam sim no cia saib txhua qhov thaiv cov lej hauv cov ncauj lus kom ntxaws.

Thov rov ua dua txoj haujlwm yav dhau los "Siv IPhone lossis IPad thiab Micro: ntsis Game Pad App los tswj lub tsheb RC" kauj ruam 16 txog 23 kom nkag siab cov lej thaiv hauv qab no uas tau siv tib yam hauv txoj haujlwm no.

  • muaj nuj nqi taw qhia -> Saib txoj haujlwm yav dhau los Kauj Ruam 16
  • muaj nuj nqi rau pem hauv ntej -> Saib txoj haujlwm yav dhau los Kauj Ruam 17
  • ua haujlwm rov qab -> Saib txoj haujlwm yav dhau los Kauj Ruam 18
  • muaj nuj nqi nres -> Saib txoj haujlwm yav dhau los Kauj Ruam 19
  • ntawm gamepad khawm A nqis, nce -> Saib qhov haujlwm yav dhau los Kauj Ruam 20
  • ntawm gamepad khawm B nqis, nce -> Saib txoj haujlwm yav dhau los Kauj ruam 21
  • ntawm gamepad khawm C nqis, nce -> Saib txoj haujlwm yav dhau los Kauj Ruam 22
  • ntawm gamepad khawm D nqis, nce -> Saib txoj haujlwm yav dhau los Kauj Ruam 23

Cov lej thaiv saum toj no tau siv rau kev tsav tsheb mus rau tom ntej, rov qab, tig sab laug lossis sab xis, thaum nias lub pob A, B, C thiab D.

Kauj Ruam 6: Txhim Kho "Tshiab" Block Codes Peb Yuav Siv

Txhim kho qhov
Txhim kho qhov

Ua kom pom cov LED hauv txoj haujlwm no, koj yuav ntxiv cov lej "tshiab" hauv qab no thiab siv lawv ua ke nrog "qub" thaiv cov lej uas koj tau tshuaj xyuas hauv qib kawg.

Cov "tshiab" thaiv cov lej no xav tau rau txoj haujlwm no kom pom cov LEDs.

  • thaum pib
  • muaj nuj nqi LED
  • ntawm gamepad khawm 1 nqis
  • ntawm gamepad khawm 2 nqes

Cia peb saib txhua qhov thaiv hauv ob peb kauj ruam tom ntej.

Kauj ruam 7: Thaum Pib

Thaum Pib
Thaum Pib

thaum pib thaiv

Qhov thaiv no yog hu ua thawj zaug ib zaug thaum "tus txais" micro: ntsis tau qhib.

Qhov kev pabcuam bluetooth io tus pin yuav tso cai rau lwm tus lej thaiv ua haujlwm nrog cov lej thiab analog pins ntawm Bluetooth kev sib txuas lus.

Los ntawm Kev Ua Haujlwm txuas ntxiv, luag thiab poob hu xov tooj rau sab hauv thaum pib thaiv. Nws yuav hu ua kev tswj hwm lub luag haujlwm thiab lub tsheb lub tsheb saib ncaj ncaj ua ntej.

Los ntawm Valenta Board_Model txuas ntxiv, rub thiab poob xaiv pawg qauv Zero thaiv nyob rau ntawm qhov pib thaiv, yog li koj "tus txais" micro: me ntsis tuaj yeem lees paub tias koj yuav siv Valenta Zero lub cev tswj rau Valenta Off-Roader.

Kauj Ruam 8: Muaj nuj nqi LED

Muaj nuj nqi LED
Muaj nuj nqi LED

Cov kauj ruam no yog qhov uas koj tuaj yeem txhais tias LEDs yuav ci li cas, thiab yog vim li cas nws thiaj yog cov kauj ruam tseem ceeb tshaj plaws ntawm txhua qhov hauv txoj haujlwm no!

Ua ntej, cia ua lub teeb pom kev sib txawv boolean uas muaj tus nqi 0 lossis 1. 0 txhais tau tias tua cov LEDs. 1 txhais tau tias tig rau LEDs. Koj yuav siv qhov sib txawv no los qhib thiab tua LEDs. Los ntawm Variables txuas ntxiv, nyem Ua Tus Hloov Pauv khawm thiab tsim lub teeb sib txawv.

muaj nuj nqi LED thaiv

Los ntawm Kev Ua Haujlwm txuas ntxiv, nyem Ua kom muaj nuj nqi khawm los tsim cov haujlwm LED. Los ntawm Loops txuas ntxiv, luag thiab poob thaum ua thaiv hauv kev ua haujlwm LED. Los ntawm Logic txuas ntxiv, luag thiab poob 0 = 0 thaiv. Los ntawm Variables txuas ntxiv, rub thiab tso lub teeb pom kev sib txawv boolean mus rau sab laug ntawm 0 = 0 thaiv, yog li nws zoo li lub teeb = 0 thaiv. Kuj tseem hloov sab xis rau 1, yog li nws zoo li lub teeb = 1. Tom qab ntawd, luag thiab poob lub teeb = 1 thaiv mus rau qhov hex ib feem ntawm thaum ua thaiv hauv kev ua haujlwm LED. Nws ua dab tsi, thaum lub teeb pom kev sib txawv boolean tau teeb tsa rau 1 tig rau LEDs, koj yuav ua kom muaj kev ua haujlwm LED hauv lub voj.

Lub caij no, cia tham txog RGB xim! Cov xim RGB yog xim uas yuav tsum tau ua los ntawm kev sib xyaw Liab, Ntsuab, Xiav ntau txoj hauv kev. Txhua xim tuaj yeem sawv cev tus lej hauv thaj tsam ntawm 0 txog 255. Koj tuaj yeem nthuav qhia RGB xim hauv peb zaug (r, g, b) los ntawm (0, 0, 0) txog (255, 255, 255).

Hauv txoj haujlwm no, vim li cas peb thiaj tsis cia lub khoos phis tawj khaws tus lej tsis raug ntawm 0 txog 255 rau txhua Liab, Ntsuab thiab Xiav, muab txhua tus nqi tso rau hauv ob peb zaug thiab xaiv qhov tsis tau xav txog RGB xim rau txhua tus lej ntawm 0, 1, 2 thiab 3 nruab ntawm lub tshuab tsav!

Hauv Cov Ntawv Sib Txuas txuas ntxiv, nyem Ua Tus Hloov pauv khawm los tsim qhov sib txawv n1, n2 thiab n3 kom khaws peb tus lej tsis raug rau ib pliag. Los ntawm Math txuas ntxiv, rub thiab poob xaiv qhov thaiv tsis raug thiab txhais qhov ntau ntawm 0 txog 255, yog li nws zoo nkaus li xaiv qhov random 0 txog 255 thiab muab qhov no tso rau sab hauv teeb n1 txhawm rau thaiv los ntawm Variables txuas ntxiv, yog li nws zoo li tau teeb tsa n1 xaiv qhov random 0 txog 255 thiab muab qhov thaiv no tso rau thaum ua thaiv. Rov ua cov txheej txheem no los tsim cov thaiv rau n2 thiab n3.

Los ntawm Valenta FireLED txuas ntxiv, rub thiab poob hloov pauv los ntawm liab 0 ntsuab 0 xiav 0 thaiv thiab hloov txhua tus lej nrog qhov sib txawv n1, n2 thiab n3 los ntawm Variables txuas ntxiv, yog li nws zoo li hloov pauv los ntawm liab n1, ntsuab n2 xiav n3 thaiv. Qhov thaiv no tuaj yeem khaws tus lej tsis raug ntawm 0 txog 255 rau txhua Liab, Ntsuab thiab Xiav, thiab peb cov xim no yuav sib xyaw ua ke txhawm rau txiav txim siab qhov tsis paub meej RGB xim!

Los ntawm Valenta FireLED txuas ntxiv, rub thiab tso teeb LED ntawm 0 txhawm rau txhawm rau thiab sib txuas nws nrog hloov los ntawm liab n1, ntsuab n2 xiav n3 thaiv, yog li nws zoo li tau teeb tsa LED ntawm 0 kom hloov los ntawm liab n1 ntsuab n2 xiav n3 thaiv. Muaj x4 LEDs suav los ntawm 0, 1, 2 thiab 3, yog li rov ua cov txheej txheem no los tsim txhua qhov thaiv rau LED 1, 2 thiab 3.

Thaum kawg, koj yuav teem sijhawm ntev npaum li cas rau lub teeb ci LED? Los ntawm Basic txuas ntxiv, rub thiab tso ncua (ms) thaiv. 1000 (ms) yog 1 thib ob. Cia peb teem sijhawm raws li ncua (ms) 500, piv txwv. Los ntawm Valenta Hluav Taws Xob LED txuas ntxiv, rub thiab tshem tawm txhua qhov LEDs thaiv nyob rau hauv thaum ua thaiv, yog li txhua lub LEDs yuav rov pib dua lawv cov xim txhua 0.5 vib nas this.

Cov kauj ruam tom ntej yog yuav ua li cas koj yuav xaiv lub khawm twg ntawm Game Pad hauv iOS app los hloov lub teeb pom kev ntawm boolean los ntawm 0 txog 1 (lossis 1 txog 0) kom qhib (lossis tua) LEDs.

Kauj Ruam 9: Ntawm Gamepad Khawm 1, 2 Down

Ntawm Gamepad Khawm 1, 2 Down
Ntawm Gamepad Khawm 1, 2 Down

Koj tuaj yeem hloov kho qhov khawm uas yuav ua rau thiab tawm ntawm LEDs thiab nws yog nyob ntawm koj tag nrho.

Ntawm Game Pad hauv iOS app, yuav ua li cas hais txog nias lub pob 1 cia LEDs qhib, thiab nias lub pob 2 cia lub LEDs tua?

Yav dhau los, koj tau ua lub teeb pom kev sib txawv boolean uas muaj tus nqi 0 lossis 1. 0 txhais tau tias tua LEDs. 1 txhais tau tias tig rau LEDs. Koj yuav siv qhov sib txawv no los qhib thiab tua LEDs.

ntawm gamepad khawm 1 down block

Los ntawm Devices txuas ntxiv, luag thiab poob rau gamepad khawm 1 nqes los. Los ntawm Cov Kev Sib Txuas txuas ntxiv, rub thiab tso teeb lub teeb rau 1, yog li cov haujlwm LED yuav raug siv los qhib rau LEDs. Los ntawm Kev Ua Haujlwm txuas ntxiv, luag thiab poob hu rau LED thaiv. Tag nrho cov LEDs yuav pom kev tshwm sim.

ntawm gamepad khawm 2 down block

Los ntawm Devices txuas ntxiv, luag thiab poob rau gamepad khawm 2 nqes. Los ntawm Cov Kev Sib Txuas txuas ntxiv, rub thiab tso teeb lub teeb rau 0, yog li cov haujlwm LED yuav raug siv los tua LEDs. Los ntawm Kev Ua Haujlwm txuas ntxiv, luag thiab poob hu rau LED thaiv. Txhua lub LEDs yuav raug tua.

Pom zoo: