Cov txheej txheem:

3D4x Game: 3D 4x4x4 Tic-Tac-Toe: 5 Kauj Ruam (nrog Duab)
3D4x Game: 3D 4x4x4 Tic-Tac-Toe: 5 Kauj Ruam (nrog Duab)

Video: 3D4x Game: 3D 4x4x4 Tic-Tac-Toe: 5 Kauj Ruam (nrog Duab)

Video: 3D4x Game: 3D 4x4x4 Tic-Tac-Toe: 5 Kauj Ruam (nrog Duab)
Video: 4Play — 3D tic tac toe (Kickstarter promo video) 2024, Kaum ib hlis
Anonim
Image
Image
3D4x Game: 3D 4x4x4 Tic-Tac-Toe
3D4x Game: 3D 4x4x4 Tic-Tac-Toe
3D4x Game: 3D 4x4x4 Tic-Tac-Toe
3D4x Game: 3D 4x4x4 Tic-Tac-Toe
3D4x Game: 3D 4x4x4 Tic-Tac-Toe
3D4x Game: 3D 4x4x4 Tic-Tac-Toe

Koj puas nkees ua si ib yam, qub, tho txawv, 2-dimensional tic-tac-toe ?? Zoo peb muaj cov tshuaj rau koj! Tic-tac-ntiv taw hauv 3-qhov loj me !!! Rau 2 tus neeg ua si, hauv 4x4x4 lub voos xwmfab, tau txais 4 LEDs uake (hauv ib qho kev qhia) thiab koj yeej! Koj ua nws. Koj ua si nws.

Kauj Ruam 1: Sau Cov Cheeb Tsam thiab Cov Cuab Yeej

Sau Cov Khoom Siv thiab Cov Cuab Yeej
Sau Cov Khoom Siv thiab Cov Cuab Yeej

Qhov tseem ceeb tshaj plaws ntawm 3D Tic-Tac-Toe 3D yog LED. Peb tau xaiv PL9823 uas twb muaj cov tswj hwm sab hauv. Nws muaj plaub tus pin (Cov Ntaub Ntawv-hauv, Voltage-Supply, Hauv av, Cov Ntaub Ntawv-Tawm), thiab tso cai rau koj kom yooj yim nyob thiab tswj cov xim ntawm LED. Cov kab sib chaws tuaj yeem tsim ua ntau txoj hauv kev sib txawv, tab sis rau peb qhov no yog qhov pheej yig tshaj, ruaj tshaj plaws, thiab xaiv qhov zoo nkauj tshaj plaws.

Daim Ntawv Teev Npe:

  • Arduino (peb siv Uno)
  • PL9823 LEDs (tsawg kawg 64)
  • Ntoo skewer sticks (ntev 24cm)
  • Kev thaiv (peb siv sab hauv ntawm tus qub ethernet cable)
  • Khawm (xeev xwm txheej)
  • 7 Resistors (220Ohm)
  • Breadboards (1 rau cov nyees khawm thiab ua si, 1 rau kev sib txuas yooj yim rau Arduino)
  • Ua npuas ncauj polystyrene board (~ 2x30x30cm los ua vaj huam sib luag)
  • Ua npuas ncauj polystyrene thaiv (~ 7x25x25cm raws li lub hauv paus rau txhua daim phiaj)

Daim Ntawv Teev Npe:

  • Soldering hlau
  • Soldering tin
  • Kua nplaum
  • Ncaj nrog tus kav
  • Pliers
  • Cov hlua hlau
  • Hlau txiav
  • Txiab
  • Cim
  • Cwj mem
  • Tweezers

Kauj ruam 2: Ua daim phiaj

Image
Image
Ua daim phiaj
Ua daim phiaj
Ua daim phiaj
Ua daim phiaj

Peb ua 4 panels ntawm 4x4 LEDs ib tus zuj zus.

  • 00: Tau txais styrofoam los ua vaj huam sib luag teeb tsa. Kos tus qauv. Hauv qhov no, peb siv 6cm sib nrug ntawm LEDs nrog 2cm ntawm qhov kawg.
  • 01: Ntxig cov pins LED rau hauv styrofoam. Tseem ceeb! Nco ntsoov tias koj ntxig rau txhua lub LED nrog tib txoj kev taw qhia. Hauv peb qhov xwm txheej, peb tau xaiv tus pin tso rau sab laug.
  • 02: Tam sim no tso cov pas nrig pas ntoo rau ntawm ob sab ntawm LEDs hauv kab, ua kom ntseeg tau tias cov ntsiab lus txhua lub ntsej muag zoo ib yam. Kua nplaum rau ntawm ob sab ntawm qhov muag teev LED thiab cia kom qhuav.
  • 03: Ua tib yam rau txhua kab ntawm cov pas nrig pas ntoo ntawm ob sab ntawm LEDs, ua kom ntseeg tau tias cov ntsiab lus txhua lub ntsej muag zoo ib yam. Kua nplaum thiab cia kom qhuav.
  • 04: Maj mam tshem tawm los ntawm xoob cov LEDs ib puag ncig. Nqa lub vaj huam sib luag tawm thiab ntxeev dua. Kua nplaum rau sab nraum qab kom nws muaj kev nyab xeeb dua.
  • 05: Tom qab txhua yam qhuav, khoov tus pin kom ua kom yooj yim dua thiab pab kom tsis txhob muaj cov kab hluav taws xob hla hla. Peb siv lub tweezer thiab khoov tus pin los ze rau lub hauv paus.
  • 06: Tam sim no npaj cov xov hlau. Peb siv cov xov tooj cua ethernet qub uas muaj 4-twisted-khub xov hlau sab hauv. Tshem cov rwb thaiv tsev ua tib zoo tsis txhob txiav cov xov hlau me. Tom qab ntawd tsis hloov pauv, xaiv koj cov xim kom sib haum rau cov kab sib txawv, thiab txiav mus rau qhov ntev ntawm txoj cai ntawm LEDs. Tom qab ntawd hle ib qho me me ntawm cov rwb thaiv tsev tawm ntawm qhov kawg. Peb xaiv hauv av = ntsuab, Vdc = xiav, cov ntaub ntawv hauv/tawm = dawb.
  • 07: cog! Muaj ntau qhov kev sib txuas (64x4), yog li ceev faj kom muab tshuaj txhuam kom raug.
  • 08: Tshem lub vaj huam sib luag, thiab tso rau ntawm lub hauv paus ua npuas ncauj!

Kauj Ruam 3: Ua Joystick

Ua tus Joystick
Ua tus Joystick
Ua tus Joystick
Ua tus Joystick

Peb tau siv lub khob cij los ua tus joystick rau kev siv kab sib chaws thiab ua qhov kev xaiv. Peb tso cov neeg dhia, cov neeg tawm tsam, thiab cov nyees khawm txhawm rau tsim lub Circuit Court (saib daim duab) uas piav qhia tus tswj kev tswj (6 nyees khawm, 1 rau txhua qhov kev taw qhia) thiab khawm xaiv (nkag mus rau tus neeg uas ua ntawv txav mus). 5V thiab hauv av tau txuas nrog cov chaw nres nkoj txheeb ze ntawm Arduino. Rau cov analog thiab cov lej nkag peb tau xaiv Arduino cov chaw nres nkoj A5 thiab 2, feem.

Kev xaiv khawm muaj cov txheej txheem yooj yim nrog rau kev tiv thaiv kev sib tsoo. Cov lus qhia kev coj ua yog ua raws tus tiv thaiv ntaiv uas ua haujlwm raws li kev faib hluav taws xob hluav taws xob: qhov hluav taws xob mus rau cov lus sib piv sib piv nyob ntawm qhov nias lub pob thiab txhais los ntawm Arduino ua ib qho kev hais kom ua.

Kauj Ruam 4: Sau Txoj Cai

Sau Txoj Cai
Sau Txoj Cai

Peb tau tshaj tawm peb cov cai rau koj siv:) Ua ntej, ua qhov txuas hluav taws xob mus rau Arduino. Peb muab lub khob cij me me tso rau ntawm Arduino kom yooj yim dua. Peb txuas Arduino "GND" thiab "5V" rau 2 kab ntawm breadboad qhov uas peb tom qab ntawd ntsaws rau hauv av thiab Vdc los ntawm txhua lub vaj huam sib luag. Txog Cov Ntaub Ntawv-Hauv thiab Cov Ntaub Ntawv-Tawm peb xaiv 4 qhov sib txawv Arduino pins, 13, 10, 7, thiab 4 rau txhua lub vaj huam sib luag. PL9823 LEDs tuaj yeem hais qhia tus kheej los ntawm tus lej xaj ntawm LED hauv koob. Piv txwv li, yog tias koj xav tig 1st LED rau qee yam xim, hais txog LED [0]. Rau lub 16 LED, chaw nyob LED [15]. Tam sim no koj npaj txhij rau cov lej thiab ua si nrog lub teeb zoo nkauj! Hauv qab no yog kev piav qhia dav dav ntawm cov cai ntawm 3D tic-tac-toe game.

Txoj Cai ntawm 3D4x Game

Peb siv lub tsev qiv ntawv fastled.h uas tso cai rau peb los tswj cov micro-LEDs tswj.

Lub voos xwmfab tau cim tau zoo hauv 3D cov lej sib xyaw "TTTMap", qhov twg txhua lub hauv paus tuaj yeem nyob hauv 1 ntawm 5 lub xeev raws li lub teeb sib xws yog tus tswv: 0 = tsis muaj tus neeg ua si, 1 = neeg uas ua ntawv 1, 2 = neeg uas ua ntawv 2, 3 = player 1 hauv kev sib tw yeej, thiab 3 = player 2 hauv kev sib tw yeej. Txhawm rau txhawm rau qhia cov ntsiab lus ntawm lub voos xwmfab virtual hauv TTTMap rau cov LEDs tiag, cov lej suav nrog LEDMap0, LEDMap1, LEDMap2, LEDMap3 tau siv.

Qhov "teeb tsa" ua haujlwm pib Arduino cov chaw nres nkoj txuas nrog lub vaj huam sib luag, pib ua ntej txhua lub LEDs rau "dub", thiab pib ua lub ntsiab ntawm TTTMap array rau 0.

Txoj haujlwm "voj" ua haujlwm "ReadButtonInput ()", "SendLED ()", thiab, yog tias ib tus neeg ua si yeej, ua haujlwm "VictoryAnimation ()". Thawj qhov muaj nuj nqi nyeem cov lus sib piv ntawm cov lus txib thiab cov tswv yim digital ntawm khawm xaiv. Cov boolean hloov pauv "ButtonPushed" thiab "SelectPushed" tau siv los txhawm rau zam kom tsis txhob txav mus los ntau zaus ntawm lub voj nrawm thaum khawm khawm. Lub luag haujlwm "SendLED ()" rov kho cov xwm txheej LED los ntawm kev xa cov teeb liab tswj raws li cov ntaub ntawv hauv TTTMap. Lub luag haujlwm tseem ceeb yog "CheckVictory ()" uas hu los ntawm "ReadButtonInput ()" txhua lub sijhawm xaiv lub pob raug thawb. Qhov kev ua haujlwm no txheeb xyuas yog tias cov ntsiab lus xaiv hauv qhov chaw ua kom muaj kev sib tw nrog cov pins puag ncig. Yog tias yeej qhov sib tw, cov ntsiab lus hauv TTTMap tau kos npe nrog tus lej 3 lossis 4, raws li tus neeg uas ua ntawv uas yeej, thiab zoo siab "VictoryAnimation ()" khiav!

Ua si dua, tsuas yog ntaus lub khawm pib dua ntawm Arduino:)

Kauj Ruam 5: Ua Si Nrog Koj Cov Phooj Ywg

Ua Si Nrog Koj Cov Phooj Ywg!
Ua Si Nrog Koj Cov Phooj Ywg!
Ua Si Nrog Koj Cov Phooj Ywg!
Ua Si Nrog Koj Cov Phooj Ywg!
Ua Si Nrog Koj Cov Phooj Ywg!
Ua Si Nrog Koj Cov Phooj Ywg!

Tsis muaj kev piav qhia ntawm no xav tau … YUAV TSUM!

Pom zoo: