Cov txheej txheem:
- Khoom siv
- Kauj ruam 1: Cov ntaub ntawv
- Kauj ruam 2: Daim duab txuas
- Kauj Ruam 3: Kho rau SPI
- Kauj ruam 4: Txoj Cai
- Kauj Ruam 5: Qhov tshwm sim
- Kauj Ruam 6: Siv CrowPi2-Cov Khoom
- Kauj Ruam 7: Siv CrowPi2- Daim Duab Txuas
- Kauj Ruam 8: Siv CrowPi2- Kho rau SPI
- Kauj Ruam 9: Siv CrowPi2- Txoj Cai
- Kauj ruam 10: Siv CrowPi2-Qhov tshwm sim
- Kauj Ruam 11: Siv CrowPi2- Mus Ntxiv
Video: Tsim Tsob Ntoo Sib Tham Sib Txuas Siv Minecraft Raspberry Pi Edition: 11 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Nag hmo, Kuv pom kuv tus tub 8-xyoo-laus ua si Minecraft nrog Raspberry Pi Kuv tau muab rau nws ua ntej, tom qab ntawd kuv tau txais lub tswv yim, uas yog siv tus lej los ua qhov kev hloov pauv thiab txaus siab Minecraft-pi LED blocks project. Minecraft Pi yog txoj hauv kev zoo los pib nrog Raspberry Pi microcomputer, Minecraft Pi yog qhov tshwj xeeb kev cai tsim ntawm Minecraft uas tso cai rau peb los cuam tshuam nrog kev ua si siv qhov yooj yim tuag Python API los kho qhov kev ua si thiab khoom siv!
Muaj ntau txoj haujlwm koj tuaj yeem ua hauv Minecraft ntiaj teb nrog Raspberry Pi tab sis tshwj xeeb rau peb nws tsis txaus, peb tab tom nrhiav qee yam nyuaj thiab ntsais muag tib lub sijhawm. Hauv txoj haujlwm no, peb yuav nqis tes ua ntau yam Minecraft thaiv, txheeb xyuas tus ID ntawm qhov thaiv thiab txheeb xyuas cov xim ntawm cov thaiv tshwj xeeb peb tau nqis tes ua, raws li cov xim peb yuav teeb peb RGB LED los tsim cov kev sib tham sib tham game!
Kuv yuav siv ob txoj hauv kev kom ua tiav cov txiaj ntsig, thawj qhov yog siv cov khoom siv, uas yuav ua rau muaj kev ntxhov siab heev …; qhov thib ob yog siv CrowPi2 (kawm khoos phis tawj nrog ntau lub ntsuas ntsuas, tam sim no muaj neeg coob coob ntawm Kickstarter: CrowPi2)
cia peb pib thiab pom yuav ua li cas khaws cov phiaj xwm zoo li no!
Khoom siv
CrowPi2 tam sim no nyob ntawm kickstarter tam sim no, CrowPi2 txoj haujlwm tau nce yuav luag $ 250k.
Ntaus qhov txuas:
Txoj Kev 1 Siv cov khoom siv ntxiv
Kauj ruam 1: Cov ntaub ntawv
● 1 x Raspberry Pi 4 qauv B.
● 1 x TF daim npav nrog duab
● 1 x Raspberry Pi fais fab mov
● 1 x 10.1 nti saib
● 1 x Lub hwj chim rau saib
● 1 x HDMI cable
● 1 x Keyboard thiab nas
● 1 x RGB coj (Common cathode)
● 4 x Jumpers (Poj niam rau poj niam)
Kauj ruam 2: Daim duab txuas
Muaj tiag tiag peb lub teeb hauv RGB xim LED, uas yog lub teeb liab, lub teeb ntsuab thiab lub teeb xiav. Tswj peb lub teeb no kom tso lub teeb ntawm qhov sib txawv, thiab thaum sib xyaw, lawv tuaj yeem tso lub teeb ntawm ntau xim. Plaub tus pin ntawm LED teeb yog GND, R, G, thiab B, feem. RGB LED Kuv siv yog ib qho cathode ntau, thiab kev sib txuas rau Raspberry Pi yog raws li hauv qab no:
RaspberryPi 4B (hauv lub npe ua haujlwm) RGB LED
GPIO0 1 RED
GPIO1 3 GREEN
GPIO2 4 XEEB
GND 2 GND
Daim duab thib ob yog kho vajtse txuas
Kauj Ruam 3: Kho rau SPI
Vim tias peb xav tau siv SPI los tswj RGB, peb yuav tsum ua kom SPI interface ua ntej, uas yog neeg xiam oob khab los ntawm lub neej ntawd. Koj tuaj yeem ua raws cov theem hauv qab no kom pab tau SPI interface:
Ua ntej, koj tuaj yeem siv Desktop GUI los ntawm nqe lus mus rau Pi pib MenupreferencesRaspberry Pi Kev teeb tsa, raws li nws tau qhia hauv thawj daim duab.
Qhov thib ob, mus rau "Kev cuam tshuam" thiab pab kom SPI thiab nyem OK (daim duab thib ob).
Thaum kawg, rov pib dua koj Pi kom ntseeg tau tias qhov kev hloov pauv kom ua haujlwm. Nyem rau ntawm Pi Start MenuPreferencesShutdown. Txij li peb tsuas yog xav tau rov pib dua, nyem rau ntawm Reboot khawm.
Kauj ruam 4: Txoj Cai
Peb yuav pib los ntawm kev sau peb tus nab npawb nab npawb, ua ntej, peb yuav pib los ntawm kev nkag mus rau qee lub tsev qiv ntawv uas peb yuav xav tau txhawm rau txhawm rau ua ke peb cov lej nrog Minecraft ntiaj teb. Tom qab ntawd, peb yuav ntshuam lub tsev qiv ntawv lub sijhawm, tshwj xeeb yog lub luag haujlwm hu ua pw tsaug zog. Kev pw tsaug zog yuav tso cai rau peb tos lub sijhawm tshwj xeeb ua ntej ua haujlwm. Qhov kawg tab sis tsis tsawg, peb xa RPi. GPIO lub tsev qiv ntawv uas tso cai rau peb los tswj GPIO ntawm Raspberry Pi.
los ntawm mcpi.minecraft ntshuam Minecraft los ntawm lub sijhawm ntshuam ntshuam ntshuam RPi. GPIO li GPIO
Thiab qhov ntawd yog nws, peb tau ua tiav nrog kev xa cov tsev qiv ntawv, tam sim no nws yog lub sijhawm los siv lawv! Thawj qhov ua ntej, yog siv Minecraft lub tsev qiv ntawv, peb xav txuas peb cov ntawv nab nab mus rau Minecraft ntiaj teb, peb tuaj yeem ua qhov no los ntawm kev thov pib () ua haujlwm ntawm MCPI lub tsev qiv ntawv thiab tom qab ntawd teeb tsa hom GPIO thiab kaw qhov ceeb toom.
mc = Minecraft.create () GPIO.setmode (GPIO. BCM) GPIO.setwarnings (0)
Tam sim no, peb txhais qee cov xim zaj sawv hauv hexadecimal kom peb tuaj yeem hloov xim RGB.
WHITE = 0xFFFFFF RED = 0xFF0000 ORANGE = 0xFF7F00 YELLOW = 0xFFFF00 GREEN = 0x00FF00 CYAN = 0x00FFFF BLUE = 0x0000FF PURPLE = 0xFF00FF MAGENTA = 0xFF0090
Tom ntej no, peb yuav tsum tau txheeb xyuas qee qhov kev hloov pauv los sau cov xim ntawm cov ntaub plaub, uas tau hais tseg hauv Minecraft block list.
W_WHITE = 0 W_RED = 14 W_ORANGE = 1 W_YELLOW = 4 W_GREEN = 5 W_CYAN = 9 W_BLUE = 11 W_PURPLE = 10 W_MAGENTA = 2
Peb ID ntawm cov ntaub plaub hauv Minecraft yog 35. Tam sim no, peb yuav tsum teeb tsa tus pin rau RGB coj thiab teeb tsa rau lawv.
red_pin = 17 green_pin = 18 blue_pin = 27
GPIO.setup (red_pin, GPIO. OUT, pib = 1) GPIO.setup (green_pin, GPIO. OUT, pib = 1) GPIO.setup (blue_pin, GPIO. OUT, pib = 1)
Tom qab ntawd, teeb tsa PWM rau txhua tus pin, nco ntsoov tias qhov ntau ntawm PWM tus nqi yog 0-100. Ntawm no, peb teeb cov xim ntawm RGB coj mus dawb (100, 100, 100) ua ntej.
red = GPIO. PWM (red_pin, 100)
ntsuab = GPIO. PWM (ntsuab_pin, 100) xiav = GPIO. PWM (blue_pin, 100) liab.start (100) ntsuab.start (100) blue.start (100)
Nram qab no yog los tsim ob txoj haujlwm, uas tuaj yeem siv los txiav txim xim thiab teeb lub RGB coj! Nco tseg tias map2hundred () muaj nuj nqi yog daim duab qhia chaw ntawm 255 txog 100, raws li peb tau hais los ua ntej, PWM tus nqi yuav tsum yog 0-100.
def map2hundred (tus nqi): rov qab int (tus nqi * 100 /255)
def set_color (color_code): # Txiav txim siab red_value = color_code >> 16 & 0xFF ntsuab_value = color_code >> 8 & 0xFF blue_value = color_code >> 0 & 0xFF
# Daim ntawv qhia qhov tseem ceeb red_value = map2hundred (red_value) green_value = map2hundred (green_value) blue_value = map2hundred (blue_value)
# Teeb pom kev! liab. ChangeDutyCycle (red_value) ntsuab. ChangeDutyCycle (ntsuab_value) blue. ChangeDutyCycle (blue_value)
Ua tau zoo! Nws yog lub sijhawm los pib peb txoj haujlwm tseem ceeb, tos, lwm qhov sib txawv yuav tsum tau txhais kom sau cov xim xim ntawm cov ntaub thaiv plaub hau ua ntej qhov haujlwm tseem ceeb:
last_data = 0 sim: x, y, z = mc.player.getPos () mc.setBlocks (x, y, z, x+1, y, z+2, 35, 14) mc.setBlocks (x+2, y+1, z, x+3, y+1, z+2, 35, 11) mc.setBlocks (x+4, y+2, z, x+5, y+2, z+2, 35, 2) mc.setBlocks (x+6, y+3, z, x+7, y+3, z+2, 35, 5) mc.setBlocks (x+8, y+4, z, x+9, y+4, z+2, 35, 4) mc.setBlocks (x+10, y+5, z, x+11, y+5, z+2, 35, 10) mc.setBlocks (x+12, y+6, z, x+13, y+6, z+2, 35, 1) mc.setBlocks (x+14, y+5, z, x+15, y+5, z+2, 35, 10) mc.setBlocks (x+16, y+4, z, x+17, y+4, z+2, 35, 4) mc.setBlocks (x+18, y+3, z, x+19, y+3, z+2, 35, 5) mc.setBlocks (x+20, y+2, z, x+21, y+2, z+2, 35, 2) mc.setBlocks (x+22, y+1, z, x+23, y+1, z+2, 35, 11) mc.setBlocks (x+24, y, z, x+25, y, z+2, 35, 14) thaum muaj tseeb: x, y, z = mc.player.getPos () # player position (x, y, z) block = mc.getBlockWithData (x, y-1, z) # block ID #print (thaiv) yog block.id == WOOL thiab last_data! = Block.data: yog block.data == W_RED: print ("Liab!") Set_color (RED) yog block.data == W_ORANGE: print ("Orange!") Set_color (ORANGE) yog block.data == W_nws YELLOW: print ("Yellow!") Set_color (YELLOW) yog block.data == W_GREEN: print ("Green!") Set_color (GREEN) yog block.data == W_CYAN: print ("Cyan!") Set_color (CYAN)) yog block.data == W_BLUE: print ("Blue!") set_color (BLUE) yog block.data == W_PURPLE: print ("Purple!") set_color (PURPLE) yog block.data == W_MAGENTA: print (" Magenta! ") Set_color (MAGENTA) yog block.data == W_WHITE: luam tawm (" Dawb! ") Set_color (WHITE) last_data = block.data pw (0.05) tshwj tsis yog KeyboardInterrupt: dhau GPIO.cleanup ()
Raws li txoj haujlwm tseem ceeb tau qhia saum toj no, ua ntej siv qee cov lus txib los tsim qee cov ntaub plaub uas muaj xim, tom qab ntawd peb yuav tsum nrhiav tus neeg ua haujlwm txoj haujlwm kom peb tuaj yeem tau txais cov block 'id thiab nws cov xim xim. Tom qab tau txais cov ntaub ntawv thaiv, peb yuav siv nqe lus los txiav txim seb qhov thaiv hauv qab cov neeg ua si yog cov ntaub thaiv plaub thiab seb nws puas muaj xim xim. Yog tias yog, txiav txim tias xim twg cov plaub tsiaj thaiv yog thiab hu rau set_color () muaj nuj nqi los hloov xim ntawm RGB coj tib yam li cov ntaub plaub.
Ib qho ntxiv, peb ntxiv qhov sim/tshwj tsis yog nqe lus kom tau txais qhov tshwj xeeb ntawm cov neeg siv cuam tshuam thaum peb xav txiav tawm txoj haujlwm kom tshem tawm cov txiaj ntsig ntawm GPIO pins.
Txuas nrog yog ua tiav cov cai.
Ua tau zoo, muaj ntau yam khoom siv ntxiv thiab nyuaj heev? Tsis txhob txhawj xeeb, cia saib ob txoj hauv kev kom ua tiav txoj haujlwm, uas yuav ua rau koj xav tias hloov pauv tau yooj yim dua thiab yooj yim dua, uas yog siv peb CrowPi2!
Kauj Ruam 5: Qhov tshwm sim
Qhib qhov kev ua si thiab sau tsab ntawv, koj yuav pom qhov tshwm sim hauv cov vis dis aus saum toj no
Tom qab ntawd peb yuav siv CrowPi2 los tsim Rainbow sib tham sib txuas tom ntej
Kauj Ruam 6: Siv CrowPi2-Cov Khoom
● 1 x CrowPi2
Kauj Ruam 7: Siv CrowPi2- Daim Duab Txuas
Tsis xav tau. Muaj ntau qhov txiaj ntsig zoo thiab cov khoom siv (ntau dua 20) ntawm CrowPi2, nws yog txhua yam hauv ib lub raspberry pi laptop thiab STEM kev kawm ua haujlwm uas tso cai rau peb ua ntau txoj haujlwm tau yooj yim thiab tsis muaj hws! Hauv qhov no, peb yuav siv qhov ntxim nyiam thiab muaj xim zoo nkauj ntawm CrowPi2, uas yog 8x8 RGB matrix module, uas tso cai rau peb los tswj 64 RGB coj tib lub sijhawm!
Kauj Ruam 8: Siv CrowPi2- Kho rau SPI
Tsis xav tau. CrowPi2 los nrog cov duab ua nrog nrog kev kawm paub! Txhua yam tau npaj lawm uas txhais tau tias koj tuaj yeem ua haujlwm thiab kawm ncaj qha. Dhau li, nrog peb CrowPi2 nws yooj yim thiab twb tau koom ua ke hauv pawg thawj coj ua STEAM platform npaj mus.
Kauj Ruam 9: Siv CrowPi2- Txoj Cai
Tam sim no, nws yog lub sijhawm pib peb txoj haujlwm! Ua ntej, ntshuam ob peb lub tsev qiv ntawv, xws li MCPI lub tsev qiv ntawv uas yog Minecraft Pi Python lub tsev qiv ntawv uas tso cai rau peb siv API yooj yim heev los ua ke nrog Minecraft ntiaj teb; lub sijhawm qiv ntawv uas tso cai rau peb kom peb pw tsaug zog kom tos lub sijhawm tshwj xeeb ua ntej ua haujlwm; RPi. GPIO tsev qiv ntawv uas tso cai rau peb los tswj Raspberry Pi GPIO pins.
los ntawm mcpi.minecraft ntshuam Minecraft los ntawm lub sijhawm ntshuam ntshuam ntshuam RPi. GPIO li GPIO
Thaum kawg, peb yuav xa cov tsev qiv ntawv hu ua rpi_ws281x uas yog RGB Matrix lub tsev qiv ntawv, sab hauv lub tsev qiv ntawv, muaj ntau txoj haujlwm uas peb yuav siv xws li PixelStrip txhawm rau teeb tsa cov khoom siv LED kab thiab xim los teeb tsa lub teeb xim RGB rau lub teeb peb RGB LEDs
los ntawm rpi_ws281x ntshuam PixelStrip, Xim
Thiab qhov ntawd yog nws, peb tau ua tiav nrog kev xa cov tsev qiv ntawv, tam sim no nws yog lub sijhawm los siv lawv! Ib yam nkaus, thawj qhov yog siv lub tsev qiv ntawv Minecraft, peb xav txuas peb cov ntawv nab nab mus rau Minecraft ntiaj teb peb tuaj yeem ua qhov no los ntawm kev pib ua haujlwm pib ntawm MCPI lub tsev qiv ntawv:
mc = Minecraft.create ()
Tam sim no txhua lub sijhawm peb xav ua haujlwm ntawm lub ntiaj teb minecrat, peb tuaj yeem siv cov khoom mc.
Cov kauj ruam tom ntej yuav yog txhawm rau txheeb xyuas RGB LED matrix chav kawm uas peb yuav siv los tswj peb RGB LEDs, peb pib chav kawm nrog teeb tsa yooj yim xws li tus lej ntawm leds, pins, ci ci thiab lwm yam …
peb tsim txoj haujlwm hu ua huv uas yuav "ntxuav" tsawg dua nrog cov xim tshwj xeeb thiab tseem muaj lub luag haujlwm hu ua khiav uas yuav pib qhov tseeb RGB LED khoom thaum thawj zaug peb xav siv nws.
chav kawm RGB_Matrix:
def _init _ (tus kheej):
# LED teeb teeb tsa:
tus kheej. LED_COUNT = 64 # Tus lej ntawm LED pixels.
self. LED_PIN = 12 # GPIO tus pin txuas nrog lub pixels (18 siv PWM!).
self. LED_FREQ_HZ = 800000 # LED teeb liab zaus hauv hertz (feem ntau yog 800khz)
self. LED_DMA = 10 # DMA channel siv los tsim cov teeb liab (sim 10)
self. LED_BRIGHTNESS = 10 # Teeb rau 0 rau qhov tsaus ntuj thiab 255 rau qhov ci tshaj plaws
self. LED_INVERT = Cuav # Muaj tseeb los hloov lub teeb liab
self. LED_CHANNEL = 0 # teeb tsa '1' rau GPIOs 13, 19, 41, 45 lossis 53
# Txhais lub luag haujlwm uas ua rau LEDs nyob rau ntau txoj hauv kev. def huv (tus kheej, kab txaij, xim):
# so tag nrho cov LED ib zaug
rau kuv hauv ntau (strip.numPixels ()):
strip.setPixelColor (kuv, xim)
strip.show ()
def khiav (tus kheej):
# Tsim NeoPixel cov khoom nrog kev teeb tsa tsim nyog.
sawb = PixelStrip (tus kheej. LED_COUNT, tus kheej. LED_PIN, tus kheej. LED_FREQ_HZ, tus kheej. LED_DMA, tus kheej. LED_INVERT, tus kheej. LED_BRIGHTNESS, tus kheej. LED_CHANNEL)
sim:
rov qab strip
tshwj tsis yog KeyboardInterrupt:
# ntxuav lub matrix LED ua ntej cuam tshuam
tus kheej.clean (strip)
Tom qab peb tau ua tiav nrog cov lus saum toj no, nws yog lub sijhawm los thov cov chav kawm thiab tsim cov khoom uas peb tuaj yeem siv hauv peb cov cai, ua ntej cia peb tsim RGB LED matrix object uas peb tuaj yeem siv siv chav kawm peb tau tsim ua ntej:
matrixObject = RGB_Matrix () cov
Tam sim no cia siv cov khoom no los tsim cov khoom siv ua haujlwm zoo nkauj uas peb yuav siv los tswj peb tus kheej LEDs ntawm RGB Matrix:
strip = matrixObject.run () cov
Thaum kawg txhawm rau qhib txoj hlua no, peb yuav tsum tau ua ib txoj haujlwm kawg:
strip.begin ()
Minecraft API suav nrog ntau qhov thaiv, txhua Minecraft thaiv nws muaj nws tus lej. Hauv peb qhov piv txwv peb tau coj qee qhov ntawm Minecraft thaiv thiab sim twv seb cov xim twg haum rau lawv tshaj plaws.
RGB sawv rau Liab, Ntsuab thiab xiav yog li peb yuav xav tau 3 qhov sib txawv xws li 0 txog 255 rau txhua tus, xim tuaj yeem yog HEX lossis RGB hom, peb tab tom siv RGB hom rau peb tus piv txwv.
Hauv Minecraft Pi ntiaj teb muaj cov thaiv ib txwm ID thiab cov ntaub plaub tshwj xeeb thaiv cov ID, cov ntaub plaub tshwj xeeb los nyob hauv tus lej ID 35 tab sis nrog cov lej sib txawv mus rau ntau tus lej sib txawv … Peb yuav daws qhov teeb meem no los ntawm kev tsim 2 cais cov npe, ib qho rau ib qho thaiv thiab ib daim ntawv teev npe tshwj xeeb rau cov plaub tsiaj thaiv:
Thawj daim ntawv yog rau cov thaiv ib txwm, piv txwv li 0 sawv cev rau huab cua thaiv, peb yuav teeb nws xim 0, 0, 0 uas yog dawb paug lossis ua tiav dawb, thaum tus neeg uas ua ntawv yuav dhia lossis ya hauv qhov kev ua si RGB yuav tua, 1 yog qhov sib txawv thaiv nrog RGB xim 128, 128, 128 thiab ntxiv rau …
#Zaj sawv xim
rainbow_colors = {
"0": Xim (0, 0, 0), "1": Xim (128, 128, 128), "2": Xim (0, 255, 0), "3": Xim (160, 82, 45), "4": Xim (128, 128, 128), "22": Xim (0, 0, 255)
}
Rau cov ntaub plaub peb ua tib yam tab sis nws yog ib qho tseem ceeb kom nco ntsoov tias txhua lub thaiv muaj tus lej ntawm 35, hauv daim ntawv teev npe no peb piav qhia cov yam me me ntawm cov thaiv uas yog cov ntaub thaiv. Cov plaub tsiaj sib txawv muaj cov xim sib txawv tab sis txhua tus ntawm lawv yog cov ntaub plaub.
wool_colors = {
"6": Xim (255, 105, 180), "5": Xim (0, 255, 0), "4": Xim (255, 255, 0), "14": Xim (255, 0, 0), "2": Xim (255, 0, 255)
}
Tam sim no thaum peb tau ua tiav txhais peb qhov haujlwm tseem ceeb, chav kawm thiab kev ua haujlwm, nws yog lub sijhawm los koom ua ke nrog peb CrowPi2 RGB LED ntawm lub rooj tsav xwm.
Txoj haujlwm tseem ceeb yuav ua raws cov kev ntsuas uas peb tau hais ua ntej thiab muab qhov cuam tshuam rau ntawm cov khoom siv.
Peb yuav siv CrowPi2 RGB LED txhawm rau txhawm rau teeb lawv raws li cov kauj ruam peb ua hauv Minecraft Pi ntawm txhua qhov thaiv, cia peb pib!
Thawj qhov peb yuav ua yog txhawm rau tsim qee cov ntaub plaub uas muaj lo lus txib thiab tsim lub voj nyob ib ntus, kom cov phiaj xwm ua haujlwm ntev li peb ua si.
Peb yuav tsum tau txais qee cov ntaub ntawv los ntawm tus neeg ua si, thawj qhov peb siv player.getPos () hais kom tau txais txoj haujlwm ntawm tus neeg ua si ces peb siv getBlockWithData () kom tau txais qhov thaiv peb tam sim no sawv ntawm (y koom tes yog -1 uas txhais tau tias nyob hauv tus neeg ua si)
x, y, z = mc.player.getPos ()
mc.setBlocks (x, y, z, x+1, y, z+2, 35, 14)
mc.setBlocks (x+2, y+1, z, x+3, y+1, z+2, 35, 11)
mc.setBlocks (x+4, y+2, z, x+5, y+2, z+2, 35, 2)
mc.setBlocks (x+6, y+3, z, x+7, y+3, z+2, 35, 5)
mc.setBlocks (x+8, y+4, z, x+9, y+4, z+2, 35, 4)
mc.setBlocks (x+10, y+5, z, x+11, y+5, z+2, 35, 10)
mc.setBlocks (x+12, y+6, z, x+13, y+6, z+2, 35, 1)
mc.setBlocks (x+14, y+5, z, x+15, y+5, z+2, 35, 10)
mc.setBlocks (x+16, y+4, z, x+17, y+4, z+2, 35, 4)
mc.setBlocks (x+18, y+3, z, x+19, y+3, z+2, 35, 5)
mc.setBlocks (x+20, y+2, z, x+21, y+2, z+2, 35, 2)
mc.setBlocks (x+22, y+1, z, x+23, y+1, z+2, 35, 11)
mc.setBlocks (x+24, y, z, x+25, y, z+2, 35, 14)
thaum Muaj Tseeb:
x, y, z = mc.player.getPos () # tus neeg ua haujlwm (x, y, z)
blockType, cov ntaub ntawv = mc.getBlockWithData (x, y-1, z) # thaiv ID
luam tawm (blockType)
Tom qab ntawd peb yuav tshuaj xyuas yog tias lub thaiv yog ntaub thaiv kab thaiv, thaiv tus lej ID 35, yog tias nws yog peb yuav xa mus rau wool_colors nrog cov xim thaiv raws li tus ID ntawm phau ntawv txhais lus thiab teeb lub xim kom raug.
yog blockType == 35:
# kev cai xim xim
matrixObject.clean (strip, wool_colors [str (cov ntaub ntawv)])
Yog tias nws tsis yog cov ntaub plaub, peb yuav tshuaj xyuas yog tias lub thaiv tam sim no nyob hauv cov ntawv txhais lus zaj sawv kom tsis txhob muaj qhov tshwj xeeb, yog tias nws yog peb yuav txuas ntxiv los ntawm kev siv cov xim thiab hloov pauv RGB.
yog str (blockType) hauv zaj sawv xim:
print (rainbow_colors [str (blockType)])
matrixObject.clean (strip, rainbow_colors [str (blockType)])
tsaug zog (0.5)
Koj ib txwm tuaj yeem sim thiab ntxiv ntau qhov ntxiv rau zaj sawv xim xim ntxiv ntau xim thiab ntau qhov kev txhawb nqa thaiv!
Zoo meej! Ua cov phiaj xwm siv cov khoom siv ntxiv yog nyuaj tab sis siv CrowPi2 kev sib xyaw ua ke, txhua yam tau yooj yim dua! Dab tsi ntxiv, muaj ntau dua 20 lub ntsuas hluav taws xob thiab cov khoom siv ntawm CrowPi2, uas tso cai rau koj ua tiav koj cov phiaj xwm zoo tshaj plaws thiab txawm tias AI cov phiaj xwm!
Hauv qab no yog tus lej ua tiav:
Kauj ruam 10: Siv CrowPi2-Qhov tshwm sim
Qhib qhov game thiab sau tsab ntawv, koj yuav pom qhov tshwm sim hauv cov vis dis aus saum toj no:
Kauj Ruam 11: Siv CrowPi2- Mus Ntxiv
Tam sim no peb tau ua tiav peb txoj haujlwm muaj xim zoo nkauj hauv Minecraft game nrog CrowPi2. Vim li cas ho tsis sim siv lwm qhov kev ntsuas thiab cov khoom siv ntawm CrowPi2 los ua si nrog game, xws li joystick los tswj cov neeg siv khoom txav chaw, RFID los tsim cov thaiv raws li daim npav NFC sib txawv thiab lwm yam. Muaj kev lom zem nrog koj cov game ntawm CrowPi2 thiab vam tias koj tuaj yeem ua ntau txoj haujlwm tsis txaus ntseeg nrog CrowPi2!
Tam sim no, CrowPi2 nyob ntawm Kickstarter tam sim no, koj kuj tseem tuaj yeem txaus siab rau tus nqi txaus nyiam.
Txuas Kickstarter nplooj ntawv txuas CrowPi2
Pom zoo:
Teeb Tsob Ntoo Bonsai Tsob Ntoo: 3 Kauj Ruam
Teeb Tsob Ntoo Bonsai Tsob Ntoo: Lwm tsob ntoo xaim! Zoo, Kuv yuav tsis nkim koj lub sijhawm yuav ua li cas kom tsob ntoo, raws li muaj ntau qhov qhia tau zoo heev nyob rau ntawd. Kuv tau txais kev tshoov siab los ntawm Txiaj Ntsig Zoo Tshaj rau kev tsim tsob ntoo, thiab suziechuzie rau kuv lub tswv yim txuas xov. Hauv qhov no
Lub Vev Xaib-Tsob Ntoo Christmas Tsob Ntoo (Ib Tus Neeg Tuaj Yeem Tau Nws): 19 Cov Kauj Ruam (nrog Duab)
Lub Vev Xaib-Tsob Ntoo Christmas Tsob Ntoo (Ib Tus Neeg Tuaj Yeem Tau Nws): Koj xav paub lub vev xaib tswj hwm tsob ntoo Christmas zoo li cas? Nov yog daim vis dis aus qhia tawm kuv qhov project ntawm kuv tsob ntoo Christmas. Tam sim no cov kwj tawm tau xaus los txog tam sim no, tab sis kuv tau ua yeeb yaj kiab, ntes dab tsi tau tshwm sim: Xyoo no, nyob nruab nrab ntawm Lub Ob Hlis
THIAB LUB NEEJ !! (Sib tham sib tham rooj sib tham): 4 Kauj Ruam
THIAB LUB NEEJ !! (sib tham sib tham txog Thruth Table): Nyob zoo cov phooj ywg, Kuv vam tias koj txhua tus nyob hauv koj lub tsev zoo thiab xav tsis thoob dab tsi ntawm cov ntaub ntawv uas muaj ?? Nkag siab cov rooj vag logic yog qhov tseem ceeb heev rau ob leeg
Kev Sib Txuas Txuas Txuas Txuas Siv Bluefruit: 4 Cov Kauj Ruam
Kev Sib Txuas Tsis Sib Txuas Siv Bluefruit: Nov yog cov lus qhia yooj yim los ntawm kauj ruam qhia los hloov koj cov xov hlau nrog bluetooth tsis muaj zog txuas: Nws coj kuv ib pliag los daws qhov no vim tias tsis muaj cov ntaub ntawv hais txog kev ua qhov no nrog bluetooth niaj hnub tsis muaj zog thev naus laus zis raws li Bluefrui
Yuav Ua Li Cas Siv Qhov Tsob Ntoo Tsob Ntoo Los Ua Ke Los Ua Ib Tug Ntoo Zoo Nkauj thiab Muaj Zog Ntoo: 10 Kauj Ruam
Yuav Siv Li Cas Ib Ntus Ntoo Los Ua Ke Los Ua Ib Tug Ntoo Zoo Nkauj thiab Muaj Zog: Lub npe ntawm caj npab neeg hlau yog WoodenArm. Nws zoo nkaus li ntxim hlub heev! Yog tias koj xav paub ntau ntxiv txog WoodenArm, thov xa mus rau www.lewansoul.com Tam sim no peb tuaj yeem qhia txog WoodenArm, cia peb txav mus