Cov txheej txheem:

LED Whack-a-mole: 5 Kauj Ruam
LED Whack-a-mole: 5 Kauj Ruam

Video: LED Whack-a-mole: 5 Kauj Ruam

Video: LED Whack-a-mole: 5 Kauj Ruam
Video: Vinyl Community Contest: Mazzy's Whack a Mole (5 random records) 2024, Hlis ntuj nqeg
Anonim
LED Whack-a-mole
LED Whack-a-mole

Qhov kev ua si ntawm "Whack-a-mole" siv xya LEDs thiab tus joystick. Muaj 4 "moles" ntawm kuv lub rooj tsavxwm, sawv cev los ntawm sab laug los ntawm 3, 4, 5, thiab 6 LEDs. Ib ntawm plaub lub LEDs no yuav ci ntsa iab thiab yuav muab sijhawm tas los txhawm rau coj mus raws qhov xav tau ntawm lub joystick. Kuv teeb LEDs hauv txoj hauv kev kom cov kev xaiv ntawm tus joystick yog los ntawm sab laug mus rau sab xis: sab laug, nqes, nce, thiab sab xis.

Khoom siv

1. Arduino UNO

2. 7 LEDs (3 ntsuab, 2 liab, thiab 1 daj

3. 7 resistors 330 ohm

4. 1 ps2 joystick

5. Cov xov hlau

6. Ib lub thawv rau khoom me me

Kauj Ruam 1: Sau tag nrho Cov Khoom Siv

Koj tsis xav tau cov cuab yeej zoo nkauj los ua qhov haujlwm no. Hloov chaw ntawm 330-ohm resistors, koj tseem tuaj yeem siv 220-ohm resistors. Yog tias koj xim xim LEDs thiab cov xov hlau ces qhov ntawd ua rau nws yooj yim dua ua si ntawm qib nyuaj.

Kauj ruam 2: Ua raws li Schematic

Ua raws li Schematic
Ua raws li Schematic

Txhua yam yuav tsum phim cov duab tiag tiag ntawm txoj haujlwm tshwj tsis yog rau joystick. Kuv tus joystick muaj 5 tus pin, 4 ntawm qhov kuv tau siv: npe los saum toj mus rau hauv qab "Y", "X", "Bt", thiab "VCC", thiab "GND" txuas nrog GND thiab 5V ntawm Arduino, " X "thiab" Y "txuas nrog A0 thiab A1. Koj kuj tseem tuaj yeem siv tus lej 5 ntawm tus joystick tab sis koj yuav tau ntxiv ib qho ntxiv LED (ib qho ntxiv mole) thiab tseem ntxiv cov cai rau qhov ntawd.

Kauj Ruam 3: Yuav Ua Li Cas Game

Yuav Ua Li Cas Game
Yuav Ua Li Cas Game

Ob lub teeb nyob sab laug yog xim liab thiab ntsuab, uas qhia txog qhov tsis raug lossis raug xaiv. Lub teeb daj mus rau sab xis ntsais ntsais qhov suav rau qhov qhab nia siab tam sim no, thiab nws qhia txog qhov qhab nia txhua lub sijhawm ua tiav (thaum twg xaiv qhov tsis raug). Txhawm rau kom tau tus qhab nia, koj yuav tsum ntaus qhov sib thooj coj mus rau ntawm tus joystick thaum lub teeb pom kev zoo LED teeb nyob rau lub sijhawm tas sijhawm.

Kauj Ruam 4: Qib Nyuaj

Qib Nyuaj
Qib Nyuaj

Cov qib nyuaj uas kuv tau sau rau hauv kuv cov cai raws li qhov ruaj khov yog lub sijhawm hauv milliseconds uas tus neeg yuav tsum tau xaiv. Koj tuaj yeem cuam tshuam nrog cov sijhawm no los hloov qhov nyuaj rau koj tus kheej nyiam.

Pom zoo: