Cov txheej txheem:

Dot Jump Game (tsis siv Arduino): 6 Kauj Ruam
Dot Jump Game (tsis siv Arduino): 6 Kauj Ruam

Video: Dot Jump Game (tsis siv Arduino): 6 Kauj Ruam

Video: Dot Jump Game (tsis siv Arduino): 6 Kauj Ruam
Video: JEE 2023 Aspirants ka Sach - ๐Ÿ’” #JEE2023inApril #jee #shorts #namokaul 2024, Hlis ntuj nqeg
Anonim
Dot Jump Game (tsis siv Arduino)
Dot Jump Game (tsis siv Arduino)

Txheej txheem cej luam

Nyob zoo! Kuv yog Shivansh, tub ntxhais kawm ntawm IIIT-Hyderabad. Kuv nyob ntawm no nrog kuv thawj qhov kev qhia uas yog game tau tshoov siab los ntawm Google Chrome's Dinosaur Jump game. Qhov kev ua si yog qhov yooj yim: Dhia hla cov teeb meem nkag los txhawm rau kom tau qhab nia. Yog tias koj sib tsoo, koj xoob thiab cov qhab nia rov pib dua.

Lub ntsiab lus tseem ceeb ntawm txoj haujlwm no yog tias tsis muaj kev siv Arduino lossis lwm yam microcontroller. Nws yog qhov tau txais los ntawm cov khoom siv hluav taws xob yooj yim thiab cuam tshuam nrog kev siv Finite State Machine (FSMs) nrog kev pab los ntawm cov duab kos duab, thiab lwm yam.

Txaus siab? Cia peb pib.

Yam yuavtsum tau kawm uantej:

  • Kev paub pib-paub txog cov khoom siv hluav taws xob zoo li Resistors, Capacitors, Integrated Circuits (ICs).
  • Kev paub pib ntawm Logic Gates (THIAB, LOS YOG, Tsis yog, thiab lwm yam)
  • Kev paub txog kev ua haujlwm ntawm Flip-Flop, Counter, Multiplexer, thiab lwm yam.

NCO TSEG: Cov yuav tsum tau teev tseg saum toj no yog nkag siab txog kev ua haujlwm tag nrho ntawm txoj haujlwm. Ib tus tsis muaj kev paub tob txog qhov zoo ib yam kuj tseem tuaj yeem tsim txoj haujlwm raws li cov theem hauv cov lus qhia.

Kauj Ruam 1: Txhim Kho Tus Qauv Ua Haujlwm

Txhim Kho Tus Qauv Ua Haujlwm
Txhim Kho Tus Qauv Ua Haujlwm
Txhim Kho Tus Qauv Ua Haujlwm
Txhim Kho Tus Qauv Ua Haujlwm

Thawj txoj haujlwm yog los tsim tus qauv ua haujlwm rau txoj haujlwm. Tsuas yog tom qab ntawd peb tuaj yeem txiav txim siab cov ntaub ntawv xav tau rau txoj haujlwm. Tag nrho txoj haujlwm tuaj yeem tawg ua peb ntu.

Ntu-1: Kev Tsim Nyog Cov Teeb Meem

Ua ntej tshaj plaws, peb yuav tsum tsim kom muaj kev cuam tshuam tsis zoo rau Dot kom dhia hla. Cov teeb meem kuj tseem yuav nyob rau hauv daim ntawv ntawm qhov taw tes mem tes uas txav los ntawm ib qho kawg ntawm LED Array mus rau lwm qhov.

Txhawm rau tsim teeb meem, peb siv ob lub Timer Circuits (cov duab kos hauv qab txuas nrog), ib qho uas muaj Zaus Siab (HF Timer) thiab lwm qhov nrog Tsawg Zaus (LF Timer). Qhov 'randomness' ib feem yog ua los ntawm HF Timer uas nws cov zis tau pom ntawm txhua qhov nce ntawm LF timer (uas yog coj los ua CLK cov tswv yim). Obstacle Generation Instruction yog lub xeev ntawm HF Timer ntawm txhua qhov nce ntawm LF Timer (1 -> Tsim Kom Muaj Obstacle | 0 -> Tsis Txhob Tsim Obstacle). HF Timer yog RESET ntawm txhua 'JUMP' txhawm rau ua kom muaj kev cuam tshuam tsis sib xws. Qhov tso tawm ntawm HF Timer tau muab ua D-input rau D Flip Flop (rau khaws cia kev qhia rau lub voj voog tom ntej) nrog CLK cov tswv yim ua LF Timer Output.

Thaum cov lus qhia binary rau kev tsim teeb meem tawm, peb yuav tsum tsim kom muaj 'teeb meem teeb meem' ntawm LED Array. Peb ua li ntawd nrog kev pab ntawm 4-ntsis Counter uas nws cov zis tau muab rau 4x16 demultiplexer (DeMUX). Cov txiaj ntsig ntawm DeMUX yuav ua rau 16 qhov sib txawv LEDs ci.

Ntu -2: JUMP

Txog rau JUMP Action, peb yuav ua rau Push Button Input raws li kev qhia. Thaum cov lus qhia tau muab, cov khoom hauv kab LED nres ci thiab lwm LED saum toj no nws ci, qhia qhov dhia.

Ntu-3: Qhov tshwm sim

Qhov tshwm sim yuav zoo li: Yog tias cov khoom sib tsoo, RESET qhov kev ua si; lwm tus, nce tus qhab nia.

Kev sib tsoo tuaj yeem hais tawm raws li ANDing ntawm ob qho tib si, cov teeb meem teeb meem thiab cov khoom teeb liab rau txoj haujlwm hauv av ntawm qhov teeb meem. Yog tias tsis muaj kev sib tsoo, Point Point Counter tau nce ntxiv uas tau tshwm rau ntawm ib khub ntawm 7-ntu lus.

Kauj Ruam 2: Sib Sau Ua Ke

Cov khoom siv xav tau yog raws li hauv qab no:

  • PCB x 1, Breadboard x 3
  • LEDs: Ntsuab (31), Liab (1), BiColor: Liab+Ntsuab (1)
  • Laub Khawm x 2
  • 7-ntu Zaub x 2
  • IC 555 x 3 [rau Timer Circuits]
  • IC 7474 x 1 (D FlipFlop)
  • IC 7490 x 2 (Decade Counter) [rau cov qhab nia]
  • IC 7447 x 2 (BCD rau 7-ntu txiav suab) [rau tso saib cov qhab nia]
  • IC 4029 x 1 (4-ntsis Counter) [rau cov teeb meem tso saib]
  • IC 74154 x 1 (DeMUX) [rau cov teeb meem teeb pom kev zoo]
  • IC 7400 x 3 (TSIS lub qhov rooj)
  • IC 7404 x 1 (NAND rooj vag)
  • IC 7408 x 1 (THIAB rooj vag)
  • IC qhov (socket)
  • Qhov Hluav Taws Xob (5V)

Cov cuab yeej xav tau:

  • Soldering Hlau
  • Hlau Cutter

Kauj Ruam 3: Kev Tsim Nyog Teeb Meem: Tshooj-A

Kev Tsim Nyog Obstacle: Tshooj-A
Kev Tsim Nyog Obstacle: Tshooj-A
Kev Tsim Nyog Obstacle: Tshooj-A
Kev Tsim Nyog Obstacle: Tshooj-A

Ua ntej tshaj, peb yuav tsum teeb tsa lub sijhawm siv hluav taws xob los tsim Cov Teeb Meem Teeb Meem (HIGH/LOW).

Lub Circuit Court yuav teeb tsa raws li txoj kev xav tau tham ua ntej. Daim duab kab hluav taws xob rau tib yam yog txuas rau saum toj no. Lub Circuit Court tau ua tiav ntawm daim ntawv qhia zaub mov (txawm tias nws tseem tuaj yeem siv tau ntawm PCB) raws li hauv qab no:

  • Muab ob lub 555 ICs thiab D Flip Flop (IC 7474) hla qhov faib ntawm lub khob cij nrog qee qhov chaw seem (4-5 kab) nyob nruab nrab.
  • Txuas cov kab saum toj kawg nkaus ntawm lub khob cij nrog lub davhlau ya nyob twg zoo ntawm Voltage Source thiab kab hauv qab nrog cov dav hlau tsis zoo.
  • Ua txuas ntxiv tom qab daim duab qhia chaw. Tom qab qhov kev sib txuas tsim nyog, lub Circuit Court yuav zoo ib yam li daim duab txuas saum toj no.

NCO TSEG: Qhov tseem ceeb ntawm kev tawm tsam R1 & R2 thiab lub peev xwm C tau suav nrog siv cov zauv hauv qab no:

T = 0.694 x (R1 + 2 * R2) * C

qhov twg T xav tau Lub Sijhawm Sijhawm.

D = 0.694 x [(R1 + R2)/T] *100

qhov twg D yog Duty Cycle piv txwv li qhov sib piv ntawm ON Sijhawm rau Sijhawm Tag Nrho.

Hauv qhov haujlwm no, rau Lub Sij Hawm Zaus Siab, T = 0.5 sec thiab rau Lub Sij Hawm Zis Tsawg, T = 2 sec.

Kauj Ruam 4: Kev Tsim Nyog Teeb Meem: Tshooj-B

Kev Tsim Nyog Obstacle: Tshooj-B
Kev Tsim Nyog Obstacle: Tshooj-B
Kev Tsim Nyog Obstacle: Tshooj-B
Kev Tsim Nyog Obstacle: Tshooj-B
Kev Tsim Nyog Obstacle: Tshooj-B
Kev Tsim Nyog Obstacle: Tshooj-B

Tam sim no peb paub thaum twg los tsim qhov teeb meem, tam sim no peb yuav tsum tso tawm nws. Peb yuav siv tus lej 4-ntsis, Demultiplexer, timer thiab ntau ntawm 16 LEDs. Vim li cas 16? Qhov ntawd yog vim peb yuav ua daim duab 4-ntsis tso tawm ntawm lub txee rau 16 LEDs siv cov demultiplexer. Nws txhais tau tias lub txee yuav suav 0 txog 15 thiab tus demultiplexer yuav hloov pauv ntawm LED nrog qhov ntsuas ntawd.

Lub sijhawm ua lub luag haujlwm yog tswj hwm qhov suav suav suav nrog, piv txwv li kev nrawm ntawm cov teeb meem txav mus los. Qhov teeb meem yuav hloov pauv ib txoj haujlwm hauv Ib Lub Sijhawm Sijhawm ntawm lub sijhawm. Koj tuaj yeem ua si ib puag ncig nrog qhov sib txawv ntawm R1, R2, thiab C siv qhov sib npaug hauv cov kauj ruam dhau los kom tau txais qhov sib txawv sib txawv.

Rau LED matrix, solder 16 LEDs nyob rau hauv ib txoj kab zam nrog rau hauv av. Lub davhlau ya nyob twg zoo ntawm txhua LED yuav txuas nrog DeMUX (tom qab hloov pauv siv NOT rooj vag, txij li DeMUX muab qhov LOW tso tawm).

Daim duab kab hluav taws xob rau tib yam yog txuas rau saum toj no.

Kauj Ruam 5: JUMP thiab RESULT

JUMP thiab RESULT
JUMP thiab RESULT
JUMP thiab RESULT
JUMP thiab RESULT
JUMP thiab RESULT
JUMP thiab RESULT

Yam tom ntej yog dhia dhia. Txhawm rau ua kom pom qhov dhia, tsuas yog tso lub LED ntawm cov xim sib txawv saum cov lej, hauv av nws thiab txuas nws +lub davhlau ya nyob twg rau khawm. Txuas lwm qhov kawg ntawm lub laub khawm mus rau qhov hluav taws xob.

Tsis tas li, coj lwm lub laub khawm, tso rau ib sab rau yav dhau los thiab txuas ib qho ntawm nws cov dav hlau mus rau +5V. Lwm lub davhlau ya nyob twg mus rau NAND Gate (IC 7404) nrog rau lwm qhov kev nkag mus ntawm NAND Gate raws li kev nkag mus rau LED qis dua JUMP LED (piv txwv li cov khoom LED). Cov txiaj ntsig ntawm NAND Gate mus rau RESET (PIN 2 thiab 3 ntawm ob qho BCD Counters) ntawm tus lej ntsuas. Nrog qhov no peb ua yog tias peb rov pib dua cov qhab nia yog tias ob qho tib si OBJECT LED (hauv txoj haujlwm hauv paus) teeb liab thiab OBSTACLE teeb liab tau muab tib lub sijhawm, piv txwv li cov khoom thiab cov nyom tau sib tsoo.

Ua qee qhov kev npaj los xyuas kom meej tias ob lub khawm thawb raug nias ua ke. Koj tuaj yeem siv nyiaj npib thiab lo ob lub khawm rau nws.

Txhawm rau teeb tsa tus lej ntsuas, ua raws daim duab qhia chaw txuas rau saum toj no (Duab qhov chaw: www.iamtechnical.com).

NCO TSEG: Txuas tus pin 2 thiab 3 rau qhov tso tawm ntawm NAND Gate rau nws kom rov pib dua tus qhab nia thaum muaj kev sib tsoo nrog qhov teeb meem

Kauj Ruam 6: Zoo Siab Ua Si

Zoo Siab Ua Si!
Zoo Siab Ua Si!
Zoo Siab Ua Si!
Zoo Siab Ua Si!
Zoo Siab Ua Si!
Zoo Siab Ua Si!

Qhov ntawd yog nws. Koj tau ua tiav nrog koj qhov project. Koj tuaj yeem ntxiv qee qhov ua tiav rau nws kom nws zoo nkaus li zoo. So yog qhov zoo.

XAV.. !!

Pom zoo: