Cov txheej txheem:

Micro: ntsis Triggered Minecraft Selfie Wall Project: 10 Kauj Ruam (nrog Duab)
Micro: ntsis Triggered Minecraft Selfie Wall Project: 10 Kauj Ruam (nrog Duab)

Video: Micro: ntsis Triggered Minecraft Selfie Wall Project: 10 Kauj Ruam (nrog Duab)

Video: Micro: ntsis Triggered Minecraft Selfie Wall Project: 10 Kauj Ruam (nrog Duab)
Video: Cursed Objects That Scientists Fear 2024, Kaum ib hlis
Anonim
Image
Image

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

Ntsuas Micro: ntsis Nrog MakeCode
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

Teeb Kho Vajtse
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

Txuas Micro: ntsis thiab Raspberry Pi
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

Hloov kho Pi thiab Nruab Mu
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

Code Micro: ntsis hauv Mu
Code Micro: 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

Txuas lub Micro: ntsis rau Raspberry Pi
Txuas lub 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

Coding hauv Python
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

Teem Txhua Yam
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

Nqa Nws Txhua Qhov Ua Ke
Nqa Nws Txhua Qhov Ua Ke
Nqa Nws Txhua Qhov Ua Ke
Nqa Nws Txhua Qhov Ua Ke
Nqa Nws Txhua Qhov Ua Ke
Nqa Nws Txhua Qhov Ua Ke
Nqa Nws Txhua Qhov Ua Ke
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: