Cov txheej txheem:

Ib qho Micro: ntsis Qhia Taw Qhia rau Cov Khau Kaus mom: 5 Kauj Ruam
Ib qho Micro: ntsis Qhia Taw Qhia rau Cov Khau Kaus mom: 5 Kauj Ruam

Video: Ib qho Micro: ntsis Qhia Taw Qhia rau Cov Khau Kaus mom: 5 Kauj Ruam

Video: Ib qho Micro: ntsis Qhia Taw Qhia rau Cov Khau Kaus mom: 5 Kauj Ruam
Video: Начало → Изучайте английский → Освойте ВСЕ ОСНОВЫ АНГЛИЙСКОГО ЯЗЫКА, которые вам НУЖНО знать! 2024, Hlis ntuj nqeg
Anonim
Ib qho Micro: ntsis Qhia Taw Qhia rau Lub Kaus mom Kaus mom
Ib qho Micro: ntsis Qhia Taw Qhia rau Lub Kaus mom Kaus mom
Ib qho Micro: ntsis Qhia Taw Qhia rau Lub Kaus mom Kaus mom
Ib qho Micro: ntsis Qhia Taw Qhia rau Lub Kaus mom Kaus mom
Ib qho Micro: ntsis Qhia Taw Qhia rau Lub Kaus mom Kaus mom
Ib qho Micro: ntsis Qhia Taw Qhia rau Lub Kaus mom Kaus mom

Hloov Kho Tshiab 2018-Tsib Hlis-12

Hauv qab no koj qhia yuav ua li cas tsim kom yooj yim micro: me ntsis raws qhov taw qhia rau lub tsheb kauj vab kaus mom hlau (lossis zoo sib xws). Nws siv cov accelerometers tsim hauv micro: me ntsis raws li kev tswj hwm.

Cov ntawv sau me me nab nab yog ua kom zoo rau mu, tus khoos phis tawj me me nrog qhov tshwj xeeb "hom" rau micro: me ntsis. Hauv nws qhov hloov tshiab kawg nws los nrog cov phiaj xwm phiaj xwm thiab kuv pib xav nkag siab siv nws li cas los ntsuas qhov ntsuas (hint: xa cov ntaub ntawv raws li tuples: luam tawm ((x, y, z)), siv ob kab zauv).

Plaub tus qauv tau tshwm ntawm micro: me ntsis 5x5 LED zaub:

  • Hauv lub xeev uas so tau zoo, cov qauv sib piv tau tshwm sim. Tam sim no koj pom cov ntawv sau rau peb tus qauv sib txawv, 'firefly', 'rain' thiab 'star star' pattern. Saib thiab xaiv qhov koj nyiam tshaj plaws. Xav tias dawb los kho qhov ntsuas, ua rau lawv ntau dua lossis tsawg dua lossis khiav nrawm dua lossis qeeb dua.
  • Tom qab ntawd muaj cov "lem sab xis" lossis "lem sab laug" ntsuas nyob rau hauv daim ntawv ntawm cov xub txav. Lawv tau qhib los ntawm kev khoov koj lub taub hau sab laug lossis sab xis, los ntawm nias lub pob ntawm micro: ntsis. Hauv kab ntawv sab nraud ntawm tsab ntawv, qhib los ntawm ib qho ntawm cov nyees khawm sab nraud txuas nrog tus pin 0 thiab 1.
  • Yog tias koj khoov koj lub taub hau rov qab, lossis ob lub khawm ntawm micro: me ntsis tau qhib rau tib lub sijhawm ib qho "ceeb toom" lossis "tawg" tus qauv tau tshwm sim.

Cov qauv no-tso tawm micro: me ntsis yuav raug siv ua qhov taw qhia piv txwv rau caij tsheb kauj vab, caij ski lossis caij ski. Txhim kho micro: me ntsis ntawm koj lub kaus mom hlau thiab tswj nws nrog koj lub taub hau txoj haujlwm. Los yog txhim kho nws ntawm koj lub tsheb kauj vab, thauj cov ntawv khawm sab nraud thiab tswj nws nrog ob lub pob hluav taws xob sab nraud txuas rau lub micro: ntsis ntawm qee cov xov hlau.

Rau cov uas ua haujlwm nrog MakeCode, Kuv tau ntxiv cov ntawv thaiv hauv qib kawg, uas tuaj yeem theej ncaj qha mus rau micro: me ntsis. Nws tsis zoo nkauj tab sis muab cov haujlwm yooj yim yam tsis tas yuav tsum tau nruab mu.

Thov nco ntsoov:

  • Thaum txoj haujlwm no yuav muaj txiaj ntsig zoo rau koj kev nyab xeeb, thov nco ntsoov tias koj ib txwm qhia meej qhov chaw uas koj xav tsav tsheb siv koj txhais tes thiab caj npab.
  • Lub tswv yim tsis tau sim ntau ntawm txoj kev thiab tau npaj los ua piv txwv piv txwv nkaus xwb. Siv nws ntawm koj tus kheej txoj kev pheej hmoo.
  • Siv cov qauv yooj yim tsuas yog nyob hauv huab cua qhuav, raws li lub micro: me ntsis thiab lub roj teeb lossis LiPo pob tau nkag siab rau cov av noo. Muaj cov lus piav qhia yuav ua li cas tsim ib qho kev kaw lus ntxiv hauv qab no.

Kauj Ruam 1: Cov Khoom Siv

Ib lub micro: me ntsis. Kev siv lub computer nrog tus kho qhov mu tau teeb tsa. Battery pob lossis LiPo pob rau micro: me ntsis. Koj lub tsheb kauj vab. Kuv siv ib qho uas siv kom muaj lub teeb pom kev zoo. Ua ib daim ntawm 3mm polypropylene duab los qhia, raws li qhov deb ntawm micro: me ntsis thiab lub kaus mom hlau. Qhov kab xev ob tog los kho lub micro: me ntsis mus rau qhov deb daim thiab qhov no rau lub kaus mom hlau. kab xev, txhawm rau kho lub micro: me ntsis thiab pob roj teeb hauv lub kaus mom hlau.

Rau qhov hloov pauv ib qho: 59 x 59 x 30 mm lub thawv yas ntshiab, Tus Qauv, Berlin: 0, 70 Euro Kitronic MI: lub rooj tsav xwm, 5 GBP ob npaug ob tog kab xev thiab ib daim ntawm PP daim hlau

Rau cov hloov pauv sab nraud (cov ntsiab lus tsis tau qhia ntawm no): Jumper cables thiab ob lub keyboards, ob lub LEDs dawb, 10 kOhm resistor, lub khob cij. Crocodile clamps. M3 tooj dag ntsia hlau (20 hli), M3 nylon ceev; plaub leeg, rau tus pin 0, tus pin 1, 3V thiab hauv av. Muab cov ntsia hlau hla lub qhov hauv micro: ntsis PCB thiab kho nrog cov ntsia hlau. Lawv yooj yim dua los txuas cov khej kem.

Kauj Ruam 2: teeb tsa lub cuab yeej, teeb tsa ntawm Tsab Ntawv

Kev teeb tsa lub cuab yeej, Kev teeb tsa ntawm Tsab Ntawv
Kev teeb tsa lub cuab yeej, Kev teeb tsa ntawm Tsab Ntawv
Kev teeb tsa lub cuab yeej, Kev teeb tsa ntawm Tsab Ntawv
Kev teeb tsa lub cuab yeej, Kev teeb tsa ntawm Tsab Ntawv
  • Nruab ib lub mu editor ntawm koj lub computer.
  • Txuas lub micro: ntsis rau lub khoos phis tawj.
  • Thauj cov ntawv xav tau.
  • Nyem tsab ntawv mus rau micro: me ntsis.
  • Nyob rau hauv rooj plaub ntawm cov ntawv sau nrawm (lub kaus mom hlau), kho lub micro: me ntsis thiab lub roj teeb pob rau koj lub kaus mom hlau. Kuv siv ib daim me me ntawm cov duab los qhia yas, cov khoom koj tuaj yeem pom hauv koj lub khw muag khoom kho vajtse, raws li daim deb thiab ob sab sib txuas daim kab xev ntawm ob sab txhawm rau kho lub micro: me ntsis rau lub kaus mom hlau, tom qab ntawd kho lub micro: ntsis thiab roj teeb pob nrog cov kab xev ntawm koj lub kaus mom hlau.
  • Txhawm rau ua kom huab cua pov thawj, saib mus rau kauj ruam tom ntej.
  • Yog tias xav tau, kho tus lej x thiab z qhov pib raws li koj xav tau.

Nyob rau hauv rooj plaub ntawm cov ntawv-uas tau tsav thiab yog tias koj nyiam siv cov nyees khawm sab nraud, txuas lub khob cij lub hwj chim ntsia mus rau Gnd thiab 3V cov chaw nres nkoj ntawm micro: me ntsis. Txuas cov nyees khawm rau Gnd thiab Pin0 thiab Pin1 chaw nres nkoj

Kauj Ruam 3: Micro Python Scripts

Txuas nrog koj pom cov ntawv me me nab nab rau mu thiab micro: ntsis.

Muaj plaub tus ntawv sau: ib qho uas tswj hwm cov zaub siv siv lub khawm tsim sab hauv thiab sab nraud, peb siv siv qhov ntsuas qhov ntsuas ntawm micro: me ntsis. Lawv muaj cov qauv tsim qauv sib txawv rau lub xeev so.

Muaj tus qauv 'npauj npaim', tus qauv 'nag' thiab 'lub hnub qub poob' (qauv qauv). Cov kab ntawv yoov tshaj cum/accelerometer tau teev tseg hauv qab no. Kuj tseem muaj tsab ntawv uas muaj tag nrho peb tus qauv thiab ua haujlwm lawv hauv qhov kev txiav txim tsis raug, nrog xaiv qhov tshiab txhua lub sijhawm qhov ntsuas tau qhib.

Tus ntsuas qhov ntsuas tau raug xa mus rau lub khoos phis tawj thiab tuaj yeem nyeem tau los ntawm tus saib xyuas ntawm tus kws kho qhov mu lossis nthuav tawm ntawm cov phiaj xwm phiaj xwm.

Nws yog qhov yooj yim los hloov qhov tsis hloov kho cov ntawv sau rau koj qhov xav tau thiab nyiam.

'' 'Lub kaum ntse ntse/ntsuas qhov ntsuas lossis cov nyees khawm tsim-hauv. 2018-Tsib Hlis-07 Ib tsab ntawv yooj yooj yim uas ua rau "tus npauj npaim" zoo nyob hauv lub xeev so, sab laug lossis sab xis txav yog cov m-ntsis tau sib tw hauv qhov kev taw qhia coresponding, lossis cov nyees khawm A lossis B raug nias lossis ua txhaum qhov ntsuas/ceeb toom qauv yog tias ob lub khawm tau nyem lossis m-ntsis tau khoov rov qab. Tej zaum yuav siv rau lub tsheb kauj vab lub kaus mom hlau nraub qaum lossis zoo ib yam. Tsim rau mu micro python editor los ntawm Dr H. 3433) # nkag mus rau koj tus lej muaj txiaj ntsig de = 100 # teeb tsa lub sijhawm ncua hauv ms ff1 = 100 # teeb tsa lub nplaim taws ncua sijhawm 1 hauv ms ff2 = 50 # teeb tsa lub nplaim taws ncua sijhawm 2 hauv ms fn = 3 # teeb tsa tus naj npawb ntawm cov nplaim taws noob ntsiab lus thresh_z = 80 # tus nqi pib rau rov qab thresh_x = 350 # tus nqi pib rau sab # txhais cov duab image_l_1 = Duab ("00900:" "09000:" "97531:" "09000:" "00900") image_l_2 = Duab ("09000:" "90000:" "75319:" "90000:" "09000") image_l_3 = Duab ("90000:" "00009:" "53197:" "00009:" "90000") image_l_4 = Duab ("00009:" "00090: "" 31975: "" 00090: "" 00009 ") image_l_5 = Duab (" 00090: "" 00900: "" 19753: "" 00900: "" 00090 ") image_r_1 = Duab (" 00900: "" 00090: " "13579:" "00090:" "00900") image_r_2 = Duab ("00090:" "00009:" "91357:" "00009:" "00090") image_r_3 = Duab ("00009:" "90000:" "79135: "" 90000: "" 00009 ") image_r_4 = Duab ("90000:" "09000:" "57913:" "09000:" "90000") image_r_5 = Duab ("09000:" "00900:" "35791:" "00900:" "09000") image_z_1 = Duab ("90009:" "00000:" "00900:" "00000:" "90009") image_z_2 = Duab ("09090:" "90009:" "00000:" "90009:" "09090") # pib qhov program thaum muaj tseeb: luam tawm ((accelerometer.get_x (), accelerometer.get_y (), accelerometer.get_z ())) # yuav tsum tau siv nrog tus saib xyuas lossis cov phiaj xwm rau qhov pib tus nqi kom zoo dua qub; # hais tsis tau nrog ' #' yog tias tsis siv yog ((accelerometer.get_z ()> thresh_z) # lub taub hau rov qab, kho yog xav tau lossis (button_a.is_pressed () thiab button_b.is_pressed ())): # rau kev tswj lub hom phiaj tso saib. qhia (Image. DIAMOND_SMALL) pw (de) display.show (Image. DIAMOND) pw (de) display.show (image_z_2) pw (de) display.show (image_z_1) pw (de) display.clear () elif ((accelerometer.get_x () thresh_x) # qhia taw qhia txoj cai; kom qhib lub taub hau txog 20 degrees txoj cai lossis button_b.is_pressed ()): display.show (image_r_1) pw (de) display.show (image_r_2) pw (de) zaub. qhia (image_r_3) pw (de) display.show (image_r_4) pw (de) display.show (image_r_5) pw (de) display.clear () lwm: # 'npauj npaim' tus qauv tsim rau g hauv ntau (0, fn): # noob muab tus lej (fn) ntawm pixels x = random.randint (0, 4) # xaiv txoj haujlwm tsis raug y = random.randint (0, 4) v = 9 # noob ci siab tshaj # v = random.randint (0, 9) # xaiv tau: xaiv cov noob ci pom kev pom.set_pixel (x, y, v) # teeb hluav taws xob nrawm nrawm pw (ff1) # zaub rau ff ms # txo kev siv ntawm txhua lub pixels los ntawm ib kauj ruam rau j hauv ntau (0, 5): # rau txhua lub pixel ntawm LED teeb rau kuv hauv ntau (0, 5): b = display.get_pixel (i, j) # tau txais kev siv tam sim no yog (b> 0): f = b - 1 # txo qhov ci ci los ntawm lwm tus: f = 0 # teeb 0 raws li qis tshaj qhov tso cai tso tawm display.set_pixel (i, j, f) pw (ff2)

Kauj Ruam 4: Kev Tshaj Tawm, Huab Cua Pov Thawj Version

Ib qho kaw, Huab cua pov thawj Version
Ib qho kaw, Huab cua pov thawj Version
Ib qho kaw, Huab cua pov thawj Version
Ib qho kaw, Huab cua pov thawj Version
Ib qho kaw, Huab cua pov thawj Version
Ib qho kaw, Huab cua pov thawj Version
Ib qho kaw, Huab cua pov thawj Version
Ib qho kaw, Huab cua pov thawj Version

Raws li tau hais los saum no, cov qauv yooj yim tsis yog huab cua. Yog li kuv tau tsim cov ntawv kaw.

Txhawm rau txhawb lub micro: me ntsis ntawm no Kuv tau siv Kitronic MI: lub hwj chim pawg thawj coj saib. Nws tau siv los ntawm 3V npib xov tooj ntawm tes thiab tuaj yeem kho tau rau micro: me ntsis nrog peb tus ntsia hlau thiab txiv ntseej. Nws kuj tseem muaj qhov hloov pauv hluav taws xob. Xwb, koj tuaj yeem siv lub roj teeb LiPo.

Raws li vaj tse kuv tab tom siv 59 x 59 x 30 mm lub thawv yas ntshiab. Ib daim ntawm 3 hli yas duab los qhia ntawv npog nrog ob daim kab xev kab xev tau siv los ua qhov deb. Nws yuav tsum tau ua tom qab MI: lub zog tsis txawm yog vim cov txiv ntoo thiab tuav lub micro: me ntsis hauv qhov chaw.

Lub thawv nrog lub micro: me ntsis tom qab ntawd tsau rau lub kaus mom hlau los ntawm lwm daim ntawv yas yas npog nrog ob daim kab xev.

Kauj Ruam 5: Ua MakeCode Script

Rau cov uas tsis txaus siab lossis tuaj yeem teeb tsa mu, Kuv tau ntxiv MakeCode block tsab ntawv nrog cov haujlwm zoo sib xws. Los ntawm qhov deb tsis zoo nkauj, tab sis zoo txaus los qhia lub hauv paus ntsiab lus.

Koj tuaj yeem tsuas luam cov ntawv rau koj micro: me ntsis thiab ua si.

Pom zoo: