Cov txheej txheem:

2 Cov Neeg Txuas 4 (Puissance 4): 7 Kauj Ruam (nrog Duab)
2 Cov Neeg Txuas 4 (Puissance 4): 7 Kauj Ruam (nrog Duab)

Video: 2 Cov Neeg Txuas 4 (Puissance 4): 7 Kauj Ruam (nrog Duab)

Video: 2 Cov Neeg Txuas 4 (Puissance 4): 7 Kauj Ruam (nrog Duab)
Video: 10 самых АТМОСФЕРНЫХ мест Дагестана. БОЛЬШОЙ ВЫПУСК #Дагестан #ПутешествиеПоДагестану 2024, Kaum ib hlis
Anonim

Los ntawm ClemNafFollow Ntau los ntawm tus sau:

Kev Cai Khaub Ncaws
Kev Cai Khaub Ncaws
Kev Cai Khaub Ncaws
Kev Cai Khaub Ncaws

Txog: Kuv yog tus kws kho tshuab mecatronics thiab kuv nyiam ua khoom! Kuv tabtom ua haujlwm nrog Arduino, ua game lossis IoT. Kuv nyiam nrhiav qhov tshiab thiab ua kuv qhov zoo tshaj plaws. Xav paub ntau ntxiv txog ClemNaf »

Nyob Zoo Txhua Tus!

Hauv cov lus qhia no kuv yuav qhia koj li cas kuv tau ua ob tus neeg Txuas Txuas 4 nrog arduino nano. RGB Led qhia cov neeg ua si pawn thiab cov neeg ua si xaiv qhov twg tso nws nrog cov nyees khawm.

Qhov ua kom yuam kev ntawm cov lus qhia no yog tswj hwm qhov ntau ntawm cov tswv yim thiab cov txiaj ntsig: 49 RGB Leds thiab 3 khawm. Kuv pom zoo kom koj nyeem txhua qib ua ntej yuav pib koj tus kheej Connect4. Lawv muaj ntau qhov tsis yooj yim thiab koj yuav raug thaiv yog tias koj tsis tau tsim dua txoj cai raws tu qauv.

Kuv thov txim uas kuv tsis tau thaij duab ntau thaum kuv tab tom tsim, qhov no yog kuv thawj qhov kev qhia yog li kuv yuav txwv qee cov kauj ruam tseem ceeb. Ua siab zoo thiab ceeb toom rau kuv!

Xav tias tawm tswv yim yog tias kuv ua qee qhov yuam kev. Kuv yuav kho nws yog xav tau.

Kauj ruam 1: Npaj

Thawj kauj ruam yog kev npaj.

Koj xav ua Arduino game, tab sis koj yuav tsum xaiv qee feem ua ntej. Cov lus qhia no tsis kim, Txuas 4 yog tsim los ntawm Leds thiab arduino nano. Yog li xav tias xaiv lub thawv zoo ib yam lossis cov khoom siv hluav taws xob.

Yog tias koj mob hnyav tau txais cov hlau, tiv taus ntau dua!

Nco ntsoov tias koj yuav siv 49 RGB Leds, uas koj yuav tau tswj hwm thiab xaim. Yog li koj yuav xav tau chaw thiab yoog raws.

Qee qhov kuv muaj lub thawv ntawv uas haum qhov loj kuv xav tau rau kuv qhov kev ua si. Kuv siv nws tab sis koj tuaj yeem xaiv lub thawv ntoo.

Muaj tswv yim!

Kauj ruam 2: Yam Koj Yuav Tsum Tau

Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
  1. Khoom siv

    • 49x RGB Leds
    • 2 x74h595
    • 7x NPN transistor pn2222
    • 3 x nub
    • 1x zog hloov
    • 7 x 100Ω resistors
    • 7 x 1 kΩ resistors
    • 3 x 10 kΩ resistors
    • 2x qab
    • ib lub thawv
    • 1 x 9V pin
    • xaim
  2. Cov cuab yeej

    • Soldering hlau
    • Voltmeter
    • Hlau txiav
    • Tin

Nco ntsoov npaj evrything, koj yuav xav tau!

Kauj Ruam 3: Puas yog Arduino Nano Fit - Hloov Sau Npe

Puas yog Arduino Nano Fit - Hloov Sau Npe
Puas yog Arduino Nano Fit - Hloov Sau Npe
Puas yog Arduino Nano Fit - Hloov Sau Npe
Puas yog Arduino Nano Fit - Hloov Sau Npe

Classic txuas 4 tus ua si-board tau tsim los ntawm 7 kab thiab 6 kab. Peb muaj kab ntxiv los xaiv qhov peb xav ua si. Qhov tseeb, peb yuav tsum tsim daim phiaj 7x7.

Okay, tam sim no yam tiag pib. Yuav ua li cas tswj 49 RGB Leds nrog tsuas yog Arduino Nano? Peb puas xav tau 49 qhov txiaj ntsig? Ntau?

Peb muaj 2 xim, 49 Leds: 49*2 = 98 pins los tswj rau Leds yog tias txhua qhov hauv av txuas nrog ua ke !! Kev ceeb toom zoo: Arduino Nano muaj 18 qhov tso tawm!

Ib txoj hauv kev kom nyob ib puag ncig qhov no yog faib pawg thawj coj saib ua kab. Tag nrho cov LEDs ua ke hauv kab ntsug qhia sib koom ua ke ntawm ib qho xim (+). Txhua lub LEDs ntawm kab rov tav sib koom ua ke ib qho cathode (-).

Tam sim no yog tias kuv xav teeb lub LED nyob hauv kaum sab laug (A1), Kuv tsuas yog muab GND (-) rau A kab, thiab VCC (+) rau xim hauv 1 kab.

Txoj hauv kev los ua haujlwm ib puag ncig nws tsuas yog teeb ib kab ntawm ib lub sijhawm, tab sis ua kom nrawm heev uas lub qhov muag tsis paub tias tsuas muaj ib kab txuas rau txhua lub sijhawm!

Tus naj npawb ntawm cov txiaj ntsig xav tau nqis los ntawm 49*3 = 147 txog 7*2 + 7 = 28 tawm. Arduino Nano tsuas yog muaj 12 qhov tso tawm digital thiab 6 analog outputs (uas tuaj yeem siv los ua digital). Pom tseeb 28> 18 thiab peb yuav tsum nco ntsoov peb muaj 3 lub tswv yim (siv tau, xaiv sab laug, xaiv sab xis).

Peb yuav siv Shift Register txhawm rau txuas chaw nres nkoj. Koj tuaj yeem nkag siab tias nws ua haujlwm li cas ntawm no. Tab sis feem ntau nws yog tsim los ntawm 3 cov tswv yim thiab 8 cov txiaj ntsig. Thaum SH_CP mus ntawm LOW mus rau HIGH, DS tau nyeem thiab xa mus rau Q1 txog Q8. Thiab cov zis tuaj yeem nyeem tau thaum ST_CP mus ntawm LOW mus rau HIGH.

Yog li peb tuaj yeem tswj hwm peb 7 kab nrog 3 cov tswv yim. Vim tias peb yuav tsum muaj xim peb yuav xav tau Shift Register.

Cia saib pes tsawg tus pins nyob:

  • 7 vim
  • 3 rau xim liab
  • 3 rau xim ntsuab
  • 3 rau cov nyees khawm

Tam sim no peb muaj 16/18 tus pin siv. Txhawm rau txhawm rau ua kom zoo rau txoj haujlwm peb yuav siv tus pin zoo tib yam rau SH_CP's thiab tus pin tib yam rau ST_CP's. Yog li 14 tus pin siv. Nrog rau kab ntawv no peb tuaj yeem ntseeg tau tias tsuas yog cov leds ntsuab yuav qhib lossis tsuas yog cov liab.

Kauj Ruam 4: Daim duab Circuit Court

Daim duab Circuit Court
Daim duab Circuit Court

Nov yog Daim Duab ntawm peb Txuas 4. Kuv siv Fritzing (pub dawb) los tsim nws. Koj yuav tsum teeb 7 kab ntawm coj nrog transistors.

Nov yog Arduino tus pin:

  • D0: tsis siv
  • D1: tsis siv
  • D2: kab 1
  • D3: kab 2
  • D4: kab 3
  • D5: cev 4
  • D6: cev 5
  • D7: cev 6
  • D8: kab 7
  • D9: tsis siv
  • D10: txoj cai khawm
  • D11: khawm sab laug
  • D12: khawm siv tau
  • D13: SH_CP
  • A0: ST_CP
  • A1: DS liab
  • A2: ntsuab DS
  • A3 - A7: tsis siv

Thiab Shift Register's pins:

  • 1: lwd 2
  • 2: xoj 3
  • 3: xoj 4
  • 4: lwb 5
  • 5: lwb 6
  • 6: xoj 7
  • 7: tsis siv
  • 8: tlas
  • 9: tsis siv
  • 10: 10K resistor thiab +5V
  • 11: Arduino D13
  • 12: Arduino A1 lossis A2
  • 13: tlas
  • 14: Arduino A0
  • 1 5: ua 1
  • 16: +5V

Kauj Ruam 5: Mount Leds

Mount Leds
Mount Leds
Mount Leds
Mount Leds

Kuv daim phiaj ntawm LEDs saib txaus ntshai, nws yog kuv thawj qhov haujlwm kom maj mam!

Kuv xav tias koj tuaj yeem nrhiav kev daws teeb meem zoo dua rau teeb tsa LEDs ntawm koj lub npov. Hauv theem no koj yuav tsum muaj tswv yim thiab txawj ntse. Kuv tsis tuaj yeem pab koj tiag tiag vim tias kuv tsis pom qhov kev daws teeb meem zoo …

Nco ntsoov tias koj yuav tsum tau muab txhuam rau txhua tus LEDs tus pin ua ke thiab xaim kab thiab kab. Nws yuav tsum siv tau yooj yim, Arduino thiab Sau Npe yuav txuas nrog cov no.

Kuv pom zoo kom koj sim txhua Leds ua ntej yuav muab tshuaj txhuam rau nws, tom qab nws yuav lig dhau lawm … Ntau dua koj tuaj yeem siv kab sib txawv ntawm koj lub rooj tsavxwm: yog tias koj hloov tus pin hauv av nws yuav yooj yim dua txuas lawv ua ke.

Kauj Ruam 6: Solder Circuit

Solder Circuit
Solder Circuit

Kuv siv 2 cov laug cam: ib qho los txuas LEDs ua ke thiab lwm qhov rau hauv Circuit Court.

Yog tias koj tau ua tib zoo thiab ua kom pom tseeb koj cov kab thiab kab ntawv nkag tau yooj yim thiab tuaj yeem muab muag rau ntawm koj lub rooj tsavxwm.

Siv koj lub sijhawm! Nws yog tus yuam sij rau kev ua tiav!

Kauj Ruam 7: Txoj Haujlwm

Tam sim no koj muaj koj Connect4. Txhawm rau siv nws, koj yuav tsum xa qee qhov chaws. Mine yog ua haujlwm zoo thiab tuaj yeem siv tau.

Rub tawm nws los ntawm no thiab xa nws mus rau koj Arduino Nano.

Paub txog yam pins koj tau siv, koj yuav tsum hloov qee qhov cai yog xav tau.

Qee qhov kev hloov kho tuaj yeem ua tau: AI, sijhawm ua si, …

Pom zoo: