Cov txheej txheem:
- Kauj Ruam 1: Sau Cov Khoom
- Kauj Ruam 2: Ntsuas Micro: ntsis Nrog MakeCode
- Kauj Ruam 3: Teeb Kho Vajtse
- Kauj Ruam 4: Txuas Micro: ntsis thiab Raspberry Pi
- Kauj ruam 5: Hloov kho Pi thiab Nruab Mu
- Kauj Ruam 6: Code Micro: me ntsis hauv Mu
- Kauj Ruam 7: Txuas Micro: ntsis rau Raspberry Pi
- Kauj Ruam 8: Coding hauv Python
- Kauj Ruam 9: Teem Txhua Yam
- Kauj Ruam 10: Nqa Nws Txhua Qhov Ua Ke
Video: Micro: ntsis Triggered Minecraft Selfie Wall Project: 10 Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Zoo siab txais tos rau kuv qhov haujlwm tshiab los pab qhia rau cov tub ntxhais kawm txog lub zog ntawm kev coding thiab suav lub cev.
Thawj daim vis dis aus yog kev tshuaj xyuas sai ntawm qhov haujlwm.
Cov vis dis aus thib ob yog ua tiav cov lus qhia ib kauj ruam ntawm yuav ua li cas luam qhov phiaj xwm no thiab vam tias yuav ua kom nws zoo dua.
Txaus siab rau!
Yog tias koj nyiam, tom qab ntawv thov muab rau YouTube channel zoo li thiab sau npe nrog rau ntawm no ntawm tus xaib no ib yam!
Kauj Ruam 1: Sau Cov Khoom
Koj yuav xav tau cov hauv qab no:
1 Micro: ntsis khoom
1 Raspberry Pi
1 Raspberry Pi Lub Koob Yees Duab
1 txiv neej/poj niam header cable rau GPIO txuas
3 Cov nab kuab
Velcro Dots (yeem)
Cov Kab Xev lossis Cov Kab Xev
Minecraft Steve Lub taub hau (xaiv tau)
Kauj Ruam 2: Ntsuas Micro: ntsis Nrog MakeCode
1. Lub taub hau rau MakeCode.com thiab xaiv Micro: ntsis platform
2. Rub tawm cov duab ua ntej tsuas yog kom paub tseeb tias Micro: me ntsis ua haujlwm thiab koj nkag siab yuav siv Micro: ntsis
3. Thaum koj muaj daim duab ntawm Micro: ntsis thiab koj nkag siab yuav ua li cas rub tawm (ua raws kev qhia hauv lub vev xaib), tom qab ntawd peb tuaj yeem txav mus rau Raspberry Pi.
Kauj Ruam 3: Teeb Kho Vajtse
1. Teeb koj li Raspberry Pi - keyboard, nas, saib, thiab lub zog
2. Txuas lub koob yees duab Raspberry Pi
3. Tus tsim kom ntseeg tau tias Lub Koob Yees Duab tau qhib hauv Configuration panel
Kauj Ruam 4: Txuas Micro: ntsis thiab Raspberry Pi
1. Plug Micro: ntsis rau Raspberry Pi
2. Lub vijtsam yuav tsum qhia tias nws tau ntsaws rau hauv thiab yog li nyem OK
3. Nco ntsoov tias koj pom Micro: ntsis hauv File Manager
4. Thaum ntsaws rau hauv Micro: ntsis yuav tsum tau teeb duab los ntawm Kauj Ruam 2
Kauj ruam 5: Hloov kho Pi thiab Nruab Mu
1. Qhib Terminal ntawm Raspberry Pi thiab nkag mus rau hauv qab no txhawm rau hloov kho koj Pi
sudo apt-tau hloov tshiab
2. Peb kuj tseem yuav tsum teeb tsa lub program software hu ua Mu. Nov yog Micro Python program tsim los rau micro tswj xws li Micro: ntsis. Nruab hauv Terminal siv cov hauv qab no:
sudo apt -tau nruab mu -y
Kauj Ruam 6: Code Micro: me ntsis hauv Mu
Qhib Mu los ntawm kev mus rau Menu Programming Mu
Ntaus cov cai hauv qab no hauv Mu
los ntawm micro: ntshuam ntshuam *
thaum Muaj Tseeb:
yog pin0.is_touched ():
display.scroll ("Hais Cheese hauv 3, 2, 1, …!")
tsaug zog (500)
pin1.write_digital (1)
tsaug zog (5000)
pin1.write_digital (0)
Txuag tus lej no rau koj li Raspberry Pi
Nyem rau Flash kom ntshuam chaws rau Micro: ntsis
Kauj Ruam 7: Txuas Micro: ntsis rau Raspberry Pi
Ntxiv ib tus nab kuab clip rau Pin 0 ntawm Micro: ntsis
Ntxiv ib tus nab kuab clip rau Pin 1 ntawm Micro: ntsis
Ntxiv ib tus nab kuab rau GND ntawm Micro: me ntsis
Tus nab kuab ntawm tus Pin 1 yuav tsum tau txuas rau tus txiv neej/poj niam xaim uas tau muab txuas rau tus txiv neej coj. Tus poj niam coj ntawm cov xov hlau no mus rau GPIO tus pin 4 ntawm Raspberry Pi
Txog ntawm qhov no kuv lo tus Pin 0 tus nab kuab clip rau hauv Play-doh raws li kuv lub pob. Koj tuaj yeem tsim txhua hom khawm uas koj xaiv, tab sis qhov no yooj yim thiab yooj yim.
Koj tuaj yeem sim koj li Micro: me ntsis yog tias koj tau nyem qhov chaws. Tsis muaj dab tsi yuav tshwm sim tsuas yog koj cov lus ntawm Micro: ntsis. Nco ntsoov qhov no ua haujlwm vim tias yog koj lub tswb tsis ua haujlwm, tom qab ntawd cov kauj ruam tom ntej yuav tsis ua haujlwm ib yam.
Kauj Ruam 8: Coding hauv Python
Tsim daim nplaub tshev khaws tag nrho cov cai rau txoj haujlwm no. Koj tuaj yeem ntxiv Mu code yog tias koj xav pab nyob ua ke.
0. Txuag cov ntawv no hauv koj daim nplaub tshev. Qhov no pab qhia daim duab pixels rau ntiaj teb Minecraft.
1. Qhib Python 3
2. Nyem Cov Ntaub Ntawv Tshiab
3. Txuag Cov Ntaub Ntawv Raws li lub npe koj xav tau.
4. Sau tus lej hauv qab no
los ntawm picamera ntshuam PiCamera los ntawm gpiozero ntshuam khawm
los ntawm mcpi.minecraft ntshuam Minecraft
los ntawm lub sijhawm ntshuam pw
los ntawm skimage ntshuam io, xim
mc = Minecraft.create ()
khawm = Khawm (4, rub_up = Tsis tseeb)
## Siv daim duab nrog Micro: me ntsis
mc.postToChat ("Nias lub Khawm!") pw (2) button.wait_for_press ()
nrog PiCamera () raws li lub koob yees duab:
c amera.resolution = (100, 80)
camera.start_preview ()
tsaug zog (3)
camera.capture ('/tsev/pi/Desktop/Microbit/selfie.jpg')
camera.stop_preview ()
mc.postToChat ('ya saum huab cua thiab saib duab ntxoov ntxoo hauv av')
tsaug zog (5)
### ntsaws selfie thiab daim duab qhia chaw
selfie_rgb = io.imread ("/tsev/pi/Desktop/Microbit/selfie.jpg")
map_rgb = io.imread ("/tsev/pi/Desktop/Microbit/colour_map.png")
### Hloov mus rau Lab
selfie_lab = color.rgb2lab (selfie_rgb)
map_lab = color.rgb2lab (map_rgb)
### Kav xim ntawm daim duab qhia chaw rau Minecraft thaiv ### Thawj tuple yog kev tswj hwm ntawm daim ntawv qhia xim ### Tuple thib ob yog Minecraft block
xim = {(0, 0):(2, 0), (0, 1):(3, 0), (0, 2):(4, 0), (0, 3):(5, 0), (0, 4):(7, 0), (0, 5):(14, 0), (0, 6):(15, 0), (1, 0):(16, 0), (1, 1):(17, 0), (1, 2):(21, 0), (1, 3):(22, 0), (1, 4):(24, 0), (1, 5):(35, 0), (1, 6):(35, 1), (2, 0):(35, 2), (2, 1):(35, 3), (2, 2): (35, 4), (2, 3):(35, 5), (2, 4):(35, 6), (2, 5):(35, 7), (2, 6):(35, 8), (3, 0):(35, 9), (3, 1):(35, 10), (3, 2):(35, 11), (3, 3):(35, 12), (3, 4):(35, 13), (3, 5):(35, 14), (3, 6):(35, 15), (4, 0):(41, 0), (4, 1):(42, 0), (4, 2):(43, 0), (4, 3):(45, 0), (4, 4):(46, 0), (4, 5):(47, 0), (4, 6):(48, 0), (5, 0):(49, 0), (5, 1):(54, 0), (5, 2):(56, 0), (5, 3):(57, 0), (5, 4):(58, 0), (5, 5):(60, 0), (5, 6): (61, 0), (6, 0):(73, 0), (6, 1):(79, 0), (6, 2):(80, 0), (6, 3):(82, 0), (6, 4):(89,0), (6, 5):(103, 0), (6, 6):(246, 0)}
## Rov ua dua daim duab thiab tom qab ntawd hla daim duab qhia chaw. Nrhiav cov xim ze tshaj los ntawm daim duab qhia chaw, thiab tom qab ntawd saib qhov thaiv thiab qhov chaw
mc = Minecraft.create ()
x, y, z = mc.player.getPos ()
rau kuv, selfie_column in enumerate (selfie_lab):
rau j, selfie_pixel hauv suav sau (selfie_column):
nrug = 300
rau k, map_column in enumerate (map_lab):
rau l, map_pixel enumerate (map_column):
delta = xim.deltaE_ciede2000 (selfie_pixel, map_pixel)
yog tias delta <nrug deb:
nrug = delta
thaiv = xim [(k, l)]
mc.setBlock (x-j, y-i+60, z+5, thaiv [0], thaiv [1])
Yog tias koj xav tau kev piav qhia lossis xav tau kev pab ntxiv Kuv rub cov tswv yim los ntawm no thiab ntawm no los koom ua ke rau hauv txoj haujlwm no.
Kauj Ruam 9: Teem Txhua Yam
1. Txuag txhua txoj haujlwm.
2. Kaw Pi
3. Hlau Micro: me ntsis thiab Raspberry Pi sab hauv Steve lub taub hau siv daim kab xev thiab velcro dots (saib cov vis dis aus ncig 19 feeb cim)
4. Tau txais txhua yam rau hauv txoj haujlwm thiab txhawb zog
Kauj Ruam 10: Nqa Nws Txhua Qhov Ua Ke
1. Qhib Minecraft
2. Qhib Python program
3. Khiav Python Program thiab qhib Minecraft World
4. Ua raws cov lus qhia ntawm lub vijtsam thiab saib nws luam koj tus kheej!
Thov qhia koj cov ntawv luam tawm, tsim qauv, thiab teeb tsa kom kuv tuaj yeem kawm thiab qhia rau cov tub ntxhais kawm uas kuv qhia.
Nyob zoo sawv daws.
Pom zoo:
LEGO WALL-E Nrog Micro: ntsis: 8 Kauj Ruam (nrog Duab)
LEGO WALL-E Nrog Micro: me ntsis: Peb tab tom siv micro: me ntsis nrog rau LEGO-phooj ywg Bit Board los tswj ob lub cav servo uas yuav ua rau WALL-E tuaj yeem hla kev phom sij ntawm koj chav nyob .Rau qhov chaws peb yuav siv Microsoft MakeCode, uas yog blo
Yuav Ua Li Cas Siv Servo Motors Siv Moto: ntsis Nrog Micro: ntsis: 7 Kauj Ruam (nrog Duab)
Yuav Ua Li Cas Siv Servo Motors Siv Moto: ntsis Nrog Micro: ntsis: Ib txoj hauv kev txuas ntxiv kev ua haujlwm ntawm micro: ntsis yog siv lub rooj tsav xwm hu ua moto: ntsis los ntawm SparkFun Electronics (kwv yees li $ 15-20). Nws zoo li nyuaj thiab muaj ntau yam ntxwv, tab sis nws tsis nyuaj rau kev ua haujlwm servo motors los ntawm nws. Moto: me ntsis tso cai rau koj
Kauj Ruam Tus Kheej - Micro: Ntsis: 12 Kauj Ruam (nrog Duab)
Step Counter - Micro: Bit: Txoj haujlwm no yuav yog cov kauj ruam ntsuas. Peb yuav siv lub ntsuas qhov ntsuas cua uas tau tsim rau hauv Micro: Bit los ntsuas peb cov kauj ruam. Txhua lub sijhawm Micro: Me ntsis co peb yuav ntxiv 2 rau suav thiab tso tawm ntawm lub vijtsam
Kev ntsuas lub teeb thiab xim Nrog Pimoroni Enviro: ntsis rau Micro: ntsis: 5 Kauj Ruam
Kev ntsuas lub teeb thiab xim Nrog Pimoroni Enviro: me ntsis rau Micro: me ntsis: Kuv tau ua haujlwm ntawm qee lub cuab yeej uas tso cai ntsuas lub teeb thiab xim yav dhau los thiab koj yuav pom ntau txog qhov kev xav tom qab kev ntsuas ntsuas cov lus qhia ntawm no thiab ntawm no.Pimoroni muaj tsis ntev los no tso tawm enviro: me ntsis, ntxiv rau
Micro: ntsis Selfie Chaw Taws Teeb: 5 Kauj Ruam (nrog Duab)
Micro: ntsis Selfie Remote: Dab tsi yog micro: ntsis? Micro Bit yog ARM-based embedded system tsim los ntawm BBC rau siv hauv kev kawm khoos phis tawj hauv tebchaws Askiv.Qhov board yog 4 cm &sijhawm; 5 cm thiab muaj ARM Cortex-M0 processor, accelerometer thiab magnetometer sensors, Bluetooth thiab USB