Cov txheej txheem:
- Khoom siv
- Kauj Ruam 1: Nqa mus rau Circuit
- Kauj Ruam 2: Txoj Cai rau Teeb Pins
- Kauj Ruam 3: Txoj Cai rau Joystick Sensing
- Kauj Ruam 4: Txoj Cai Loop Txoj Cai Loj
- Kauj Ruam 5: Npaj Mus Sim
- Kauj Ruam 6: Kev Siv Arduino Nano rau Prototype
- Kauj Ruam 7: Kawg Ntim Whack-a-MoLED Prototype los nthuav qhia Koj Tus Hlub
Video: Whack-a-moLED !!: 7 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:24
Tinkercad Cov Haujlwm »
Qhov no yog LED version ntawm Whack-a-Mole Game classic.
Yeej ib txwm siv LED tawm ntawm 4 LEDs hloov lub teeb pom ntawm lub qhov thiab cov neeg ua si tua lub LED siv lub joystick tsis txhob tsoo lub mole!
Khoom siv
Arduino Uno/Nano lossis txhua lub rooj sib txawv
4 LEDs thiab sib xws tam sim no txwv cov resistors.
Joystick module nrog X, Y cov txiaj ntsig
Active Buzzer (yeem)
Jumper xov hlau.. txaus kom debug!
Kauj Ruam 1: Nqa mus rau Circuit
Nqa mus rau Arduino Uno board rau joystick module, txuas 2 analog Input pins rau X Y cov txiaj ntsig ntawm joystick.
4 LEDs kom txuas nrog siv tus tiv thaiv rau 4 Cov Digital lossis Analog tso tawm pins pins.
Active Buzzer kom txuas nrog tus lej pin
Kauj Ruam 2: Txoj Cai rau Teeb Pins
int xVal = 0, yVal = 0, butVal = 0, xPin = A0, yPin = A1, joyPin = 13, butPin = 7, speakerPin = 9;
int leftLED = A2, rightLED = A3, topLED = A4, hauv qab LED = A5;
int xaiv LED = 0; // Yuav yog ib qho ntawm A2, A3, A4 lossis A5
void teeb tsa () {
pinMode (xPin, INPUT);
pinMode (yPin, INPUT);
pinMode (sab laug LED, OUTPUT);
tus pinMode (rightLED, OUTPUT);
tus pinMode (topLED, OUTPUT); pinMode (hauv qab LED, OUTPUT);
pinMode (joyPin, OUTPUT);
tus pinMode (buzzerPin, OUTPUT);
}
Kauj Ruam 3: Txoj Cai rau Joystick Sensing
void joystickSenseRoutine ()
{
xVal = analogRead (xPin); yVal = analogRead (yPin); butVal = digitalRead (butPin);
joyPin = mapXYtoPin (xVal, yVal, butVal);
analogWrite (xaiv LED, 1024);
yog (xaiv LED! = leftLED) {analogWrite (leftLED, 0); } yog (xaiv LED! = rightLED) {analogWrite (rightLED, 0); }
yog (xaiv LED! = topLED) {analogWrite (topLED, 0); }
yog (xaiv LED! = bottomLED) {analogWrite (bottomLED, 0); }
yog (joyPin == xaiv LED) // Mole Whacked
{
analogWrite (xaiv LED, 0);
//
// Ntxiv cov lej los ua suab paj nruag/suab rau whacking moLED !!
//
}
}
int mapXYtoPin (int xVal, int yVal, int butVal) {if ((xVal <100) and (yVal 400)) {return bottomLED; }
lwm yog ((xVal> 900) thiab (yVal 400)) {rov qab topLED; }
lwm yog ((xVal 400) thiab (yVal <100)) {rov qab sab laug; }
lwm yog ((xVal 400) thiab (yVal> 900)) {rov qab rightLED; }
lwm {rov qab -1; }
}
Kauj Ruam 4: Txoj Cai Loop Txoj Cai Loj
void voj () {
rau (int kuv = 0; kuv <ntev; kuv ++)
{
yog (random (0, 100)> 90) {xaiv LED = anaPinMap (random (2, 6)));}
// Ntxiv code rau game game ntawm no
// *** *** ***
//
}
int anaPinMap (int randNum) {
yog (randNum == 2) {xa A2; }
lwm tus yog (randNum == 3) {rov qab A3; }
lwm tus yog (randNum == 4) {xa A4; }
lwm tus yog (randNum == 5) {rov qab A5; }
}
Kauj Ruam 5: Npaj Mus Sim
Kauj Ruam 6: Kev Siv Arduino Nano rau Prototype
Kev siv tib yam ua nrog Arduino nano hauv daim ntawv qhia zaub mov, kev cai ua lub rooj tsavxwm nrog LEDs, tiv thaiv thiab buzzer, thiab X-Y joystick hloov.
Kauj Ruam 7: Kawg Ntim Whack-a-MoLED Prototype los nthuav qhia Koj Tus Hlub
Cov khoom siv rau tsab ntawv:
Lub thawv ntawv yooj yim (Yam tsawg kawg 4cmX6cmX3cm), cov duab los qhia ntxiv los ntawm kev txhawb nqa.
Hniav ntawv rau npog chassis (yeem)
Multipurpose nplaum/kua nplaum
Mini breadboard (yeem)
Arduino nano cov
Me me Universal PCB
9V roj teeb rau lub zog Arduino nano (txuas rau Vin tus pin).
SPDT hloov
Cov khoom siv so (LEDs, tiv thaiv, joystick, buzzer, xov hlau) raws li tau piav qhia hauv theem 1 saum toj no.
Pom zoo:
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom - Cov Kauj Ruam ntawm Kauj Ruam: 4 Kauj Ruam
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom | Cov kauj ruam ib kauj ruam: Hauv txoj haujlwm no, kuv yuav tsim qhov yooj yim Arduino Tsheb Rov Qab Tsheb Nres Tsheb Nres Sensor Siv Arduino UNO thiab HC-SR04 Ultrasonic Sensor. Qhov no Arduino raws Lub Tsheb Rov Qab ceeb toom tuaj yeem siv rau Kev Tshawb Fawb Txog Tus Kheej, Robot Ranging thiab lwm yam
LED Whack-a-mole: 5 Kauj Ruam
LED Whack-a-mole: Qhov kev ua si ntawm "Whack-a-mole" siv xya LEDs thiab 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 kho kom ruaj
Whack a Button Multiplayer: 4 Kauj Ruam
Whack Button Multiplayer: Kev ua si zoo li Whack-a-Mole.Ua cov LEDs thiab cov nyees khawm. Muaj 2 hom: -Single player-Multiplayerin single player mode, muaj 3 qib: LEVEL_1: 1 diode rau 1 thib ob LEVEL_2: 2 diodes rau 1 thib ob LEVEL_3: 2 diodes rau 0.7 vib nas this Thiab rau qhov sib ntxiv
Whack-a-Mole! (Tsis Muaj Cai!): 9 Kauj Ruam (nrog Duab)
Whack-a-Mole! (Tsis muaj Code!): Nyob Zoo Ntiaj Teb! Kuv tau rov qab los ntawm qhov tsis pub tshaj tawm lub qhov tob thiab kuv rov qab los nrog nws dua nrog Lwm Cov Lus Qhia! Hnub no, Kuv yuav piav qhia rau koj li cas, siv tsuas yog cov hauv paus ntsiab lus ntawm kev siv hluav taws xob, TSIS TXAUS SIAB CODE, los tsim Whack-a-Mole! Koj tau txais 30 sec
Whack-a-somebody: 6 Kauj Ruam (nrog Duab)
Whack-a-somebody: Txoj haujlwm no yog rau 'Creative Electronics', Beng Electronics Engineering xyoo 4 tus qauv ntawm University of Malaga, Tsev Kawm Ntawv Kev Sib Txuas Lus (www.etsit.uma.es). Hauv cov lus qhia no peb tau tsim tus kheej ntawm Whack-a-mole