Cov txheej txheem:

3D Tic-Tac-Toe ntawm Led Cube: 11 Kauj Ruam
3D Tic-Tac-Toe ntawm Led Cube: 11 Kauj Ruam

Video: 3D Tic-Tac-Toe ntawm Led Cube: 11 Kauj Ruam

Video: 3D Tic-Tac-Toe ntawm Led Cube: 11 Kauj Ruam
Video: World Record Domino Robot (100k dominoes in 24hrs) 2024, Kaum ib hlis
Anonim
Image
Image

Koj puas tau xav ua si Tic Tac Toe hauv 3 qhov ntev hauv tsev?

Yog tias cov lus teb yog yog, Cov Lus Qhia no muab rau koj nrog txhua cov ntaub ntawv tsim nyog los tsim ib qho.

Qhov kev ua si tuaj yeem ua si ntawm 3x3x3 coj lub voos xwmfab. Txhua lub ntsiab lus yog ib leeg-xim coj, txhua LED yuav tsum tau tswj ib tus zuj zus. Ua si tic-tac-ntiv taw tsawg kawg 3 qhov cim sib txawv yog qhov tsim nyog, (feem ntau yog o x thiab tsis muaj dab tsi) txawm li cas los xij nyob rau hauv ib lub xim LED lub voos xwmfab uas yuav ua tsis tau.

Kev daws teeb meem yog coj flashing. Thaum qhov kev ua si tau pib ua txhua tus coj tawm, thawj tus neeg ua si ua si nrog qhib rau coj, tus thib ob tus neeg siv nrog lub teeb nyem, yog li kev ua si tuaj yeem ua li ntawd.

Lub joystick thiab lub pob tso cai rau koj xaiv LED qhov koj xav tso koj "kos npe".

Tau kawg, koj tuaj yeem siv koj lub voos xwmfab LED ua kev kho kom zoo nkauj. Ib txoj cai tau muab uas ua rau LEDs nyem zoo ib yam li hauv cov vis dis aus, lossis ib qho tom qab ib leeg.

Kauj Ruam 1: Sau cov Cheebtsam

Sau cov Cheebtsam
Sau cov Cheebtsam

Cov npe ntawm cov khoom tsim nyog los tsim qhov kev ua si:

  • 22*30 Universal Circuit Board (lossis loj dua)
  • Arduino UAS
  • 27 LEDs (Kuv siv 3 hli LEDs)
  • Joystick module (KY-023)
  • Khawm module (KY-004)
  • 20 M-F jumper xov hlau
  • Hlau
  • Cov xov hlau yooj ywm
  • 12 F-F txuas

Cov cuab yeej tsim nyog

  • Styrofoam Nws yuav ua rau koj txoj haujlwm yooj yim dua!
  • Cov khoom siv Soldering
  • Kub-kua nplaum phom
  • Pinchers
  • Cable-peeler
  • Tus kav
  • Sandpaper (yeem)

Kauj Ruam 2: Kos rau ntawm Styrofoam

Kos rau ntawm Styrofoam
Kos rau ntawm Styrofoam

Ua 3x3 cov cim rau ntawm ib qho styrofoam thaiv thiab muab lub qhov rau LEDs kom haum. Koj yuav tsum siv tus pas ntsuas los ua qhov ntawd.

Kauj Ruam 3: Sandpapering cov LEDs (xaiv tau)

Sandpapering LEDs (yeem)
Sandpapering LEDs (yeem)

Txhawm rau ua kom pom kev loj dua, koj tuaj yeem siv cov ntawv xuab zeb los txhuam cov LEDs.

Kauj Ruam 4: Npaj Cov Hluav Taws Xob

Cov xov hlau nthuav tawm yuav tsum yog 4.5 cm ntev, npaj 24 ntawm lawv. Cov no yuav yog lub thav duab ntawm lub voos xwmfab.

12 lub xov hlau hloov pauv tau yuav tsum tau npaj. 9 ntawm lawv yuav tsum yog 6-7 cm ntev. 3 ntawm lawv yuav tsum yog 12-13 cm. Tshem tawm ob qho kawg ntawm cov xov hlau.

Kauj Ruam 5: Siv cov LEDs

Soldering cov LEDs
Soldering cov LEDs
Soldering cov LEDs
Soldering cov LEDs
Soldering cov LEDs
Soldering cov LEDs

Ua ntej tshaj plaws, peb tab tom txuas qhov tsis zoo ua ke, qhov no feem ntau yog luv luv ntawm LED.

Muab cov LEDs tso rau ntawm styrofoam uas tau npaj ua ntej. Muab cov xov hlau raws li qhia hauv daim duab dua li qhwv cov ceg luv ib ncig ntawm cov hlau. Tom qab ntawd muab cov hlau txuas rau cov hlau kom zoo zoo, tom qab ntawd muab cov hlau txuas rau ntawm ob sab, qhov no yuav ua rau lub xwmfab ua ke.

Nws yog qhov tseem ceeb uas thaum koj npaj tau nrog ib lub xwmfab, ntsuas txhua 9 LEDs. Nws tuaj yeem ua tiav los ntawm kev txuas cov kab hlau txuas rau hauv av ntawm Arduino. Tom qab ntawd siv M-M Jumper xaim thiab txuas nws mus rau 3.3 V ntawm Arduino, thiab kov lwm sab mus rau qhov tsis muaj qhov muag ntawm LED, LED yuav tsum teeb. Yog tias tsis muaj LED teeb, tej zaum ib qho ntawm cov ceg zoo kov cov hlau kab, koj yuav tsum txheeb xyuas cov no.

Koj yuav tsum npaj 3 lub xwmfab LED.

Kauj Ruam 6: Kev Sib Tham Squares Ua Ke

Soldering Squares Ua Ke
Soldering Squares Ua Ke

Qhov no yog qhov nyuaj tshaj plaws, koj yuav tsum thov kom muaj tes pab nyob rau theem ntawd.

Muab ib lub xwmfab ntawm lub styrofoam, tom qab ntawd lo ib lub xov tooj ntawm ib sab ntawm LED, hauv txoj haujlwm ntsug. Nws yog ib qho tseem ceeb uas cov xov hlau XWB kov tau ob txhais ceg zoo ntawm LEDs. Qhwv cov ceg zoo (tus uas koj tseem tsis tau soldered) nyob ib puag ncig ntawm cov hlau thiab muab tshuaj txhuam rau nws. Ua nws nrog txhua LED.

Muab lub xwmfab thib ob rau qhov siab 2 cm. Qhwv ob txhais ceg zoo nyob ib ncig ntawm cov xov hlau ntsug. Lub xwmfab yuav nyob ntawm qhov ntawd, yog li koj tuaj yeem txhuam txhua tus tom qab ntawd.

Tom qab ntawd tso lub xwmfab kawg hauv qhov siab ntawm 4 cm. Ua cov kauj ruam tib yam li ua ntej.

TSEEM CEEB: Cov kab hlau kab rov tav yuav tsum tsis txhob kov cov kab ntsug.

Tom qab koj tau npaj nrog cov kauj ruam koj yuav tsum txheeb xyuas txhua lub LED zoo li ua ntej.

Kauj Ruam 7: Kho lub voos xwmfab rau hauv Circuit Board

Txhim kho lub voos xwmfab rau ntawm Circuit Board
Txhim kho lub voos xwmfab rau ntawm Circuit Board
Kho lub voos xwmfab rau ntawm Circuit Board
Kho lub voos xwmfab rau ntawm Circuit Board

Ua ntej tshaj plaws, koj yuav tsum siv 9 cov xov tooj pauv tau yooj yim.

Ntxig ib sab ntawm cov xaim hla lub qhov hauv lub rooj sib tham hauv Circuit Court, muab nws txuas rau kab rov tav. Ua nws nrog txhua kab xov kab rov tav. Tom qab ntawd kho lub voos xwmfab rau lub rooj tsavxwm, los ntawm kev thov kub-kua nplaum.

Qhov thib ob, siv 3 lub xov tooj hluav taws xob hloov pauv tau ntev dua.

Muab lawv tso rau hauv lub xwmfab, thiab tom qab ntawd ntxig cov ntawd hla lub qhov (Koj tuaj yeem siv lub qhov loj dua ntawm kaum ntawm pawg thawj coj saib)

Thaum koj npaj txhij nrog cov kauj ruam koj muaj 12 xov hlau dai rau hauv qab ntawm lub rooj tsavxwm. Qhov 3 xov txuas nrog rau cov xwm txheej yuav tso cai rau koj xaiv LED hauv txoj kab ntsug. 9 lub xov hlau yuav tso cai rau koj xaiv kab ntawv uas koj xav teeb lub teeb ci LED.

Kauj Ruam 8: Kuaj Cov Txuas Txuas

Solder cov Connectors
Solder cov Connectors
Solder cov Connectors
Solder cov Connectors
Solder cov Connectors
Solder cov Connectors
Solder cov Connectors
Solder cov Connectors

Muab cov kab txuas txuas rau saum toj. Koj yuav tsum cais cov kab rov tav thiab ntsug ib yam li kuv tau ua.

Solder 9 cov xov hlau rau cov txuas, raws li qhia hauv daim duab.

Tom qab ntawd muab cov xaim 3 txuas rau 3 txuas. Txuas cov xaim los ntawm sab saum toj mus rau tus pin 10, nruab nrab mus rau 11th thiab hauv qab mus rau 12th, thiab muab lawv tso rau hauv.

Kaw cov xov hlau tas rau ntawm lub rooj tsavxwm.

Koj lub voos xwmfab LED tau npaj tiav, koj yuav tsum sim tam sim no.

Kauj Ruam 9: Sim LED Cube

Sim LED Cube
Sim LED Cube

Txuas 1-9 ntawm LED lub voos xwmfab mus rau D0-D8 hauv Arduino (1 txog D0, 2 rau D1…)

Txuas 10-12 rau Arduino li:

  • 10 rau D11
  • 11 rau D10
  • 12 rau d9

Tshaj tawm cov cai muab rau Arduino.

LedRandom () muaj nuj nqi yuav ua rau cov LED nyem nyem

LedSeq () muaj nuj nqi yuav ua rau LEDs nyem rau hauv ib kab tom qab lwm qhov.

LedWrite (x, y, z, v) ua haujlwm tso cai rau koj sau ib qho LED ntawm lub voos xwmfab. x, y, z yog qhov chaw nyob, lawv yuav tsum nyob nruab nrab ntawm 1-3. v yog lub xeev ntawm LED, thaum 0 lub LED yuav tua, thaum 1 lub LED yuav qhib.

Koj tuaj yeem pom ntau LEDs cais. Tab sis xob laim LED ua rau ib qho ua ntej tua. Tab sis qhov ncua sijhawm tsuas yog 0.5ms yog li koj yuav pom lawv ob leeg qhib.

Kuv yuav sim txhim kho qhov haujlwm no rau yav tom ntej.

Kauj Ruam 10: Txuas Joystick thiab Khawm

Txuas Joystick thiab Khawm
Txuas Joystick thiab Khawm

Lub joystick module yuav tsum nyob hauv tib txoj haujlwm li lub voos xwmfab LED (raws li qhia hauv daim duab)

Khawm module:

  • Txuas tus - rau Arduino GND
  • Txuas tus + (tus pin nruab nrab) rau Arduino 5V
  • Txuas S (tus pin tso tawm) rau Arduino A3

Joystick Module:

  • SWV to A2
  • XEV to A1
  • VRX to AWM
  • +5V rau Arduino 5V
  • GND rau Arduino GND.

Tom qab ntawd kho cov qauv thiab LED lub voos xwmfab ntawm lub dav hlau yas, thiab xa cov cai mus rau Arduino.

Kauj ruam 11: Muaj kev lom zem:)

Koj 3D Tic-Tac-Toe tau npaj txhij.

Nov yog cov lus qhia luv yuav ua li cas:

  • Player 1 ua si nrog tig rau LED
  • Player 2 ua si nrog ntsais muag LED
  • LED ntsais sai dua, thaum koj nyob ntawm LED.
  • Koj tuaj yeem xaiv koj lub LED nrog Joystick. Nyem nrog Joystick tso cai rau koj nqes mus. (los ntawm qib thawj, nws yuav mus rau qib peb)
  • Laub lub pob kom tso koj kos npe rau ntawd. (Nws yuav tso nws qhov twg LED ntsais sai)
  • Tus yeej yog tus uas khaws peb lub cim hauv x, y lossis z qhia. (Cov kab pheeb ces kaum tseem tsis suav nrog)
  • Thaum ib tus neeg yeej rau saum lub ces kaum sab xis saum toj yuav ci thiab yog tias

    • Player 1 yeej. Thawj kab teeb
    • Player 2 yeej. Kab thib ob teeb tuaj
    • Qhov kev ua si tseem yuav qhia koj txog qhov chaw uas koj tau sau koj 3 yam cim.
  • Txhawm rau pib qhov kev ua si tshiab, thawb lub joystick rau ob peb feeb.

Tseem ceeb: Ib txwm thawb lub pob rau ib pliag, thiab khaws tus joystick rau ib nrab ob.

Kuv tab tom npaj txhim kho qhov kev ua si yav tom ntej, suav nrog suav nrog kab pheeb ces kaum.

Yog tias koj muaj lus nug sau ntawv tawm lossis lus.

Pom zoo: