Cov txheej txheem:
Video: POiNG! - Arduino Arcade Game!: 3 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Peb yuav tsim lub PONG-style arcade game uas siv cov khoom los ntawm "Cov Khoom Siv Ua tiav tshaj plaws UNO R3 Project" cov khoom siv los ntawm Elegoo Inc.
Kev Qhia Tawm Tag Nrho - Feem ntau ntawm ntu uas muab rau Cov Lus Qhia no tau muab rau tus sau los ntawm Elegoo Inc.
Kuv tau xav tsim ib qhov haujlwm siv LED Matrix module. Qhov yooj yim 8x8 LED zaub yuav tsum tau siv cov ntawv hloov pauv ntxiv kom muaj peev xwm hais qhia tus kheej LEDs hauv daim ntawv. Hloov chaw, txoj haujlwm no siv MAX7219 8x8 LED module. Nws yog ib qho yooj yim heev rau siv.
Kuv xav qhia tias vim muaj coob tus txuas xov tooj ntawm txoj haujlwm no, nws yuav suav tias yog INTERMEDIATE qib Qhia.
Cia peb pib!
Khoom siv
Elegoo Starter Kit Cov Khoom Siv (https://rebrand.ly/dvjb3w8)
- UNO R3 Microcontroller
- MAX7219 8x8 LED Module
- LCD 16x2 Zaub Module
- 10K Trim Potentiometer thiab pob qhov rooj
- Dupont Hlau
- 220R tus neeg tiv thaiv
- Passive Piezo Buzzer
- Cov Khoom Siv Hluav Taws Xob
- 9V 1A Adapter - xav tau vim UNO tsis tuaj yeem muab cov khoom siv txaus rau 8x8 LED Module
- Cov qhob cij
Xav Tau Cov Khoom Ntxiv
2 x 10K Linear Potentiometer - pheej yig thiab dav muaj nyob ntawm eBay, AliExpress, Banggood thiab lwm yam.
Kauj Ruam 1: Txuas Lub Circuit Court
Txhim kho lub voj voog raws li daim duab qhia kab. Siv koj lub sijhawm. Muaj ntau qhov kev sib txuas xav tau rau ob qho kev qhia.
Daim ntawv ceeb toom hauv daim duab ntawm kab lus hais tias lub zog hloov pauv tau txuas rau sab laug ntawm lub khob cij thiab 9V 1A DC Adapter tau txuas rau hauv lub zog hluav taws xob kom txaus tam sim no tau muab rau hauv LED matrix. Tsis muaj kev sib txuas ntawm 5V tus pin ntawm UNO thiab lub khob cij. TAB SIS, GND tus pin ntawm UNO txuas nrog GND ntawm lub khob cij.
Ob npaug thiab triple-xyuas koj cov haujlwm.
Kauj ruam 2: Arduino Code
Cov lus qhia no xav tias koj twb paub yuav ua haujlwm li cas hauv Arduino.
Rub tawm daim duab txuas nrog Arduino. Nco ntsoov tias koj tau ntxiv hauv LedControl lub tsev qiv ntawv rau koj lub tsev qiv ntawv Arduino. Kuv siv qhov version los ntawm Eberhard Fahle. Tsuas yog tshawb nrhiav MAX7219 hauv Kev Tswj Cov Tsev Qiv Ntawv thiab koj yuav pom thiab nruab nws.
Nco ntsoov tias cov ntawv pitches.h nyob hauv koj daim duab qhia chaw. Nws tau siv los ua suab nrov hauv qhov kev ua si.
Me ntsis txog sijhawm
Raws li kev ncua () hais kom ua tag nrho ncua kev ua tiav ntawm koj daim duab thaum nws ua haujlwm, peb hloov mus rau lub sijhawm dhau los kom tshwm sim thaum peb xav ua qhov ua kom muaj nuj nqis cuam tshuam nrog cov duab. Peb saib rau lub sijhawm ua ntej dhau los ua ntej peb ua ntu ntu ntawm daim duab xws li hloov kho qhov chaw ntawm lub pob ntawm cov zaub.
Qhov tseem ceeb dua, ncua () hais kom ua yog tsuas yog ua tiav hauv lub voj () qauv. Feem ntau nws tsis ua raws li qhov xav tau hauv lwm txoj hauv kev. Yog li txhua lub sijhawm cuam tshuam txog kev ua yeeb yaj kiab tau ua tiav hauv lub voj () txheej txheem.
Piv txwv:
Peb txhais qee qhov 'ntev' hom kev hloov pauv thiab ob peb ntawm booleans thiab tom qab ntawd teeb lawv tom kawg ntawm teeb tsa ().
bThresh = 80; // lub sijhawm hauv milliseconds ntawm pob hloov tshiab
ballTime = millis (); // teeb tsa lub sijhawm tam sim no
bon = tsis tseeb; // yog lub pob LED qhib lossis tua
ballReturn = tsis tseeb; // peb puas rov qab pob tom qab ntaus duav?
Hauv lub voj () rau kos lub pob peb muaj:
yog ((millis () - ballTime> bThresh) && bon == tsis tseeb) {// yog tias lub pob OFF thiab lub sijhawm txaus dhau los ntawm BallOn (); // qhib lub pob LED
bon = muaj tseeb; // lub pob tam sim no ON
ballTime = millis (); // rov pib ballTime rau lub sijhawm tam sim no
}
yog ((millis () - ballTime> bThresh) && bon == muaj tseeb) {// yog tias lub pob qhib thiab txaus sijhawm dhau los
ballOff (); // tua lub pob LED
bon = tsis tseeb; // lub pob tam sim no OFF
ballTime = millis (); rov pib ballTIme rau lub sijhawm tam sim no
}
Muaj ntau txoj hauv kev los ua qhov kev ua si no. Cov no tsuas yog kuv nyiam.
Cov duab kos tau sau tseg tag nrho yog li kuv caw koj nyeem cov cai kom pom tias nws ua haujlwm li cas.
Txheeb, sau thiab xa koj cov cai.
Txaus siab rau ua si koj cov game!
Kauj Ruam 3: Xaus
Kuv ua tsaug rau Elegoo Inc rau muab cov khoom siv pib siv hauv qhov haujlwm no. Nws yog cov khoom siv nrog ntau yam loj ntawm ntu thiab cov qauv uas yuav ua rau koj zoo rau hauv Arduino Maker ntiaj teb.
Pom zoo:
Khiav Koj Cov Game Ua Si ntawm Retro Arcade Kit Nrog Raspberry Pi: 7 Kauj Ruam
Khiav Koj Cov Game Ua Si ntawm Cov Khoom Retro Arcade Nrog Raspberry Pi: Koj puas muaj Steam account nrog txhua qhov kev ua si kawg? Yuav ua li cas txog lub txee arcade? Yog tias yog, vim li cas ho tsis muab ob qho tib si tso rau hauv Steam Steam gaming gaming tshuab zoo kawg. Ua tsaug rau cov neeg ntawm Steam, koj tam sim no tuaj yeem tshaj tawm cov kev ua si tshiab kawg los ntawm koj lub PC lossis Ma
Cyclone LED Arcade Game: 4 Kauj Ruam
Cyclone LED Arcade Game: Lub hom phiaj ntawm txoj haujlwm no yog tsim kom muaj kev ua si yooj yim siv Arduino uas yuav muaj kev sib tham thiab lom zem rau menyuam. Kuv nco qab Cyclone arcade game yog ib qho ntawm kuv nyiam kev ua si arcade thaum kuv tseem yau, yog li kuv txiav txim siab los theej nws. T
Stackers Arcade Game: 6 Kauj Ruam (nrog Duab)
Stackers Arcade Game: Nyob zoo cov phooj ywg, hnub no kuv xav qhia rau koj txog qhov kev ua si arcade zoo uas koj tuaj yeem ua nrog ib pawg Ws2812b LEDs thiab microcontroller/FPGA. Behold Stack Overflow - peb siv kho vajtse ntawm cov game arcade classic. Dab tsi pib ua lub tsev kawm ntawv qhov project qui
Halloween Horse Racing Arcade Game: 6 Kauj Ruam
Halloween Horse Racing Arcade Game: Xyoo no peb tau txiav txim siab ua nees sib tw arcade game rau Xus. Peb tau txais kev tshoov siab los ntawm cov tshuab khoos phis tawj hu ua Roll-a-Ball Horse Racing. Peb lub hom phiaj yog ua kom muaj kev sib tw ncaj nraim rau pem hauv ntej kom rov hais dua rau ntau tus neeg ua si. Raws li
Arcade Game Machine Nrog Raspberry Pi: 7 Kauj Ruam (nrog Duab)
Arcade Game Machine Nrog Raspberry Pi: Ua zaj dab neeg: Arcade game tshuab nrog retro pi (raspberry pi3)