Cov txheej txheem:

LED Matrix Game of Life 32 X 32: 8 Kauj Ruam
LED Matrix Game of Life 32 X 32: 8 Kauj Ruam

Video: LED Matrix Game of Life 32 X 32: 8 Kauj Ruam

Video: LED Matrix Game of Life 32 X 32: 8 Kauj Ruam
Video: How to make Custom Pixel Art with NO CODE on Any LED Grid - GlowBit Matrix With WLED & ESP32/ESP8266 2024, Hlis ntuj nqeg
Anonim
LED Matrix Game of Life 32 X 32
LED Matrix Game of Life 32 X 32

Kuv tau txais kev tshoov siab los ntawm Jptrsn's16 x16 Game of Life tab sis ua tiav plaub zaug loj dua. Kuv pom qee qhov MAX7219 Dot Matrix Module 4-in-1 Zaub Rau Arduino cov laug cam ntawm Bangood.com rau 50 3.50 thaum lawv tuaj txog nws tig los ua nyuaj heev kom tawg lawv sib nrug thiab siv lawv hauv 16x16 daim phiaj raws li kuv tau npaj tseg, yog li kuv txiav txim siab los ua daim phiaj 32x32. Qhov ntawd yog thaum yam hloov pauv, vim koj tsis tuaj yeem teev cov cai ntxiv.

Kauj Ruam 1: Qhov Chaw

Kuv tau txais kuv cov khoom los ntawm BangGood tab sis koj tuaj yeem muab cov khoom no nyob txhua qhov chaw. 1. Ib qho Arduino Nano (~ £ 2) 2. 4 1x4 Led Matrixes (~ £ 3.50 x 4) lossis saib rau ntau qhov uas qee zaum pheej yig dua 3. Qee cov xov hlau 4. USB lub qhov ((£ 1) 5. USB fais fab mov (<£ 5) 6. 6 "x6" /15cmx15cm Lub thawv duab thav duab (~ £ 4) los ntawm cov khw muag khoom siv hauv zos

Kauj Ruam 2: Cov Cuab Yeej

1. Kub kua nplaum phom

2. Soldering hlau

3. Cov hlua hluav taws xob

4. Ntsej muag riam

Kauj Ruam 3: Tsim Breadboard

Breadboard Tsim
Breadboard Tsim

Ib yam uas kuv tau kawm ntawm qhov no yog tias nano (thiab tej zaum lwm yam Arduinos) tsis tuaj yeem muab lub zog txaus los ua haujlwm tag nrho 4 ntawm cov lej tsis tas hlawv hluav taws xob! ceeb toom

Thaum kuv cov laug cam tuaj txog lawv tsuas yog tau txais tus pin ntawm qhov kawg nkag thiab cov pins tso tawm tau xoob hauv lub hnab, lossis hauv ib kis uas raug kaw hauv qab cov lus qhia luv cov pins tawm. Nws hloov tawm tias tsis zoo rau cov lus qhia no (txoj haujlwm zoo kuv yuav 6). Koj yuav tsum tau muab cov pins tso rau ntawm ob ntawm LED matrixes yog tias lawv tsis haum rau koj li.

Cov txheej txheem yog ncaj ncaj, koj tuaj yeem daisy saw ob ntawm cov lej sib xyaw ua ke los tsim ob txoj hlua los ntawm kev yooj yim txuas cov pins tso tawm mus rau cov khoom sib txuas. Koj tsis tuaj yeem txuas lawv txhua tus hauv ib qho kev khiav raws li LedControl lub tsev qiv ntawv raug txwv rau 8 cov lus qhia ib zaug.

Tom qab ntawd ntsaws DataIn rau tus pin 12, ntsaws (lossis CS) rau tus pin 11 thiab Clock (lossis CLK) rau tus pin 10 thiab rau lwm txoj saw rau 5, 4 & 3. Xwb, koj tuaj yeem xaiv ib qho digital pins uas koj nyiam tsuas yog nco ntsoov hloov cov cai los xav txog koj qhov kev xaiv. Tom qab ntawd ntxiv lub USB ntsaws rau lub khob cij. Tom qab ntawd txuas lub v+ thiab cov pins hauv av rau cov ntsia ntawm lub khob cij. Tom qab ntawd koj yuav tsum ntsaws lub hwj chim coj los ntawm 2 txoj hlua txuas mus rau +ve thiab hauv av thiab khi Arduino hauv av rau hauv av. Thaum peb ua tiav cov phiaj xwm koj tuaj yeem txuas Arduino vin rau v+ thiab tsis txhob ntsaws rau hauv Aurdino USB dua.

Kauj ruam 4: Code

Thaum xub thawj, kuv xav tias txhua yam kuv xav tau ua yog coj tus lej uas twb muaj lawm thiab ntsuas nws rau 32x32 tab sis nws yog qhov dag me ntsis dua qhov ntawd. 1. Koj xav tau ob lub LedControls raws li txhua tus tuaj yeem tsav 8 MAX7219s LedControl lc [2] = {LedControl (12, 10, 11, 8), LedControl (5, 3, 4, 8)}; 2. Tsis muaj lub cim xeeb txaus ntawm Nano los khaws 2 tag nrho 32x32 byte arrays kom ua rau lub xeev pawg thawj coj saib. (Thaum kawg, txhua lub sijhawm kuv tau sau Game of Life code ntawm lub whiteboard hauv kev xam phaj them tawm.) Yog li, peb txhais cov pawg thawj coj raws li 32x4 thiab khaws lub xeev ntawm txhua lub xov tooj raws li me ntsis hauv bytes hla kab.

Kauj Ruam 5: Muab Nws Txhua Qhov Ua Ke

Thawj qhov kev sim cov cai thiab txheej txheem ntawm cov laug cam raws li qhov xav tau los ntawm kev siv "testPattern" txoj hauv kev los kos kab pheeb ces kaum hla hla cov laug cam. Yog tias qhov no tsis zoo li yog muaj qee yam tsis raug ntawm qhov kev txiav txim ntawm cov laug cam thiab/lossis cov pins koj tau pib ua ntej. Ib zaug ntxiv yog tias nws tsis ua haujlwm ces tshawb xyuas qhov kev txiav txim ntawm tus pin thiab lwm qhov kawg, teeb tsa txoj hauv kev los ua "randomize", teeb NUMITR rau tus lej nws yuav tsum rov ua dua ua ntej rov pib dua.

Kauj Ruam 6: Txhim Kho Nws

Ncej Nws
Ncej Nws

Tam sim no muab txhua yam tso rau hauv tus ncej. Ua ntej, muab cov kua nplaum kub ua ke rau hauv daim duab 32x32. Nco ntsoov ua kom ntseeg tau tias qhov kawg ntawm kev nkag mus yog nyob rau ib sab rau txhua tus ntawm lawv (lossis hloov kho cov cai saib hauv "gridToCell" kom tso cai rau cov laug cam thib ob tau ntxeev siab). Ntxiv lub qhov hluav taws xob qhov hluav taws xob thiab hloov pauv ntawm kab 5v thiab muab txhua yam sib dhos ua ke.

Kauj Ruam 7: Teeb Meem

Nws hloov tawm tias koj xav tau lub thav duab loj dua li 6x6 ib qho kuv muaj. Yog li kuv yuav tsum rov qab los ua kom tiav qhov no thaum kuv muaj lub sijhawm los mus rau tom khw.

Kauj ruam 8:

Pom zoo: