Cov txheej txheem:

LED Game: Xim Nws Xiav: 4 Kauj Ruam
LED Game: Xim Nws Xiav: 4 Kauj Ruam

Video: LED Game: Xim Nws Xiav: 4 Kauj Ruam

Video: LED Game: Xim Nws Xiav: 4 Kauj Ruam
Video: Tswv Yexus lub neej thaum pib txug thaum xaus 2024, Kaum ib hlis
Anonim
LED Game: Xim Nws Xiav
LED Game: Xim Nws Xiav
LED Game: Xim Nws Xiav
LED Game: Xim Nws Xiav

Hauv qhov kev ua si LED no, cov neeg siv siv lub joystick los ua LEDs xiav. Lub teeb nyob nruab nrab teeb xiav, thiab cov neeg ua si yuav tsum tig sab laug ib nrab lossis sab xis ib nrab xiav. Lub teeb daj tig ib qho ntawm LEDs ntawm qhov tsis sib xws, thiab cov neeg siv yuav tsum txav lawv lub joystick mus rau sab laug lossis sab xis nyob ntawm seb lub teeb tig daj. Yog tias lub teeb nyob hauv nruab nrab tig daj thiab tsis muaj lub teeb xiav, cov neeg siv yuav tsum nias lub pob ntawm tus joystick kom tig nws xiav. Yog tias tus neeg ua si tsis ua qhov no, LEDs tig liab qhia qhov ua tsis raug.

Cov Lus Qhia no yuav qhia txhua tus neeg hauv kev ua qhov kev ua si txias no.

Kauj Ruam 1: Sau Cov Khoom

Rau qhov kev ua si no cov ntaub ntawv hauv qab no xav tau:

  1. Arduino
  2. LED sawb nrog 20 LEDs
  3. Joystick
  4. Hlau
  5. Cov qhob cij
  6. Khoos phis tawj uas muaj Arduino teeb tsa
  7. Cable txuas Arduino rau lub khoos phis tawj

Kauj Ruam 2: Teeb Game

Teeb Game
Teeb Game

Siv cov xov hlau thiab lub khob cij, txuas Joystick thiab LED sawb rau Arduino.

Kev teeb tsa dav dav:

  • Txuas 5V ntawm Arduino mus rau 5V ntawm lub khob cij.
  • Txuas GND ntawm Arduino mus rau hauv av ntawm lub khob cij.

Teeb tsa Joystick:

  • Txuas GND ntawm joystick mus rau hauv av ntawm lub khob cij.
  • Txuas tus +5V ntawm joystick mus rau 5V ntawm lub rooj noj mov.
  • Txuas VRx ntawm joystick rau tus pin analog A0 ntawm Arduino.
  • Txuas VRy ntawm joystick rau tus pin analog A1.
  • Txuas SW ntawm joystick rau tus pin 2 ntawm Arduino.

Teeb lub teeb LED:

  • Txuas GND ntawm LED kab txaij rau hauv av ntawm lub khob cij.
  • Txuas tus +5V ntawm LED sawb mus rau 5V ntawm lub khob cij.
  • Txuas cov xov hlau nruab nrab ntawm LED sawb rau tus pin 6 ntawm Arduino.

Kauj Ruam 3: Muab Txoj Cai Rau Arduino

Luam thiab paste cov cai txuas rau Arduino ntawm lub khoos phis tawj. Tom qab txuas Arduino rau lub khoos phis tawj, tso nws.

Kauj Ruam 4: Ua Si Game

  • Lub teeb xiav yuav qhib rau nruab nrab ntawm LEDs
  • Lub teeb daj yuav tig rau ntawm qhov tsis sib xws LED
  • Tuav tus joystick nrog cov xov hlau taw tes rau.
  • Tsiv tus joystick mus rau sab laug yog tias lub teeb daj tig mus rau sab laug ntawm kab txaij kom tig nws xiav.
  • Tsiv tus joystick mus rau sab xis yog tias lub teeb daj tig mus rau sab xis ntawm txoj hlua kom tig nws xiav.
  • Yog tias nruab nrab LED tig daj, nias lub pob ntawm tus joystick, yog li nws teeb xiav.
  • Yog tias tus neeg ua si txav lawv cov joystick mus rau qhov tsis raug, LEDs yuav ci liab.
  • Ua si kom pom pes tsawg zaus koj tuaj yeem txav koj lub joystick mus rau qhov raug.

Cov vis dis aus txuas nrog qhia tias kev ua si li cas.

Pom zoo: