Cov txheej txheem:

Arduino Tswj Arcade: 6 Kauj Ruam
Arduino Tswj Arcade: 6 Kauj Ruam

Video: Arduino Tswj Arcade: 6 Kauj Ruam

Video: Arduino Tswj Arcade: 6 Kauj Ruam
Video: The US Military Has Adopted The Xbox Controller 2024, Kaum ib hlis
Anonim
Arduino Tswj Arcade
Arduino Tswj Arcade

Hauv cov lus qhia no kuv yuav qhia koj li cas kuv tsim kuv cov qauv zoo li arcade uas tau tswj hwm siv Arduino thiab lub khoos phis tawj sab nraud.

Nws yuav muaj qee qhov kev xaiv raug tso tawm rau koj kom ua tiav: qhov kev tsim arcade xav tau lub ntsuas, uas txiav txim siab loj npaum li cas koj xav tau los tsim lub thav duab tag nrho.

Kauj ruam 1: Yuav tsum tau ua

Yuav tsum muaj
Yuav tsum muaj

Koj yuav xav tau: Arduino Uno

Cov xov hlau: Koj yuav xav tau ob tus txiv neej thiab poj niam xaus vim yog chav joystick. Txiv neej rau txiv neej ua ke nrog poj niam rau poj niam yuav ua haujlwm, tab sis txiv neej rau poj niam tseem yuav ua haujlwm. Kuv pom zoo ntau yam xim sib txawv.

Joystick breakout board DR811

Breadboard 170 pins (Ib qho me me) Koj tsis tas yuav siv lub tshuab ziab khaub ncaws hauv chav no, tab sis koj tuaj yeem kho qhov kuv tsim nrog nws.

Microswitch Khawm 12x12mm (Txhua lub hau xim)

10 k Ohm resistor.

Kab xev

Ntsia

(Qub) Saib Xyuas. Nyiam tshaj plaub fab.

Ntoo (lossis lwm yam uas koj yuav tsim tus ncej nrog)

Cov thav duab dawb ntawm daim duab yog qhov ua tau zoo, ib yam dab tsi zoo li qhov no yooj yim rau koj kev tswj hwm kab.

Kauj Ruam 2: Teeb tsa Arduino thaiv

Teeb tsa Arduino thaiv
Teeb tsa Arduino thaiv
Teeb tsa Arduino thaiv
Teeb tsa Arduino thaiv

Tus joystick yog qhov yooj yim heev thiab txuas nrog zoo li cov duab qhia nws. Qhov tseem ceeb yuav tsum tau muab tso rau hauv tus lej ntawm koj tus pin. Hauv kuv cov duab ob lub joystick thiab khawm tau pom tias lawv tau muab tso rau hauv qhov 2. Peb yuav tsis siv lub joystick tus yuam sij (qhov no yog rau nias lub joystick lub pob). Yog li kuv muab qhov no tso rau 3 (rau yog tias koj xav ua ib yam dab tsi nrog qhov ntawd).

X thiab Y tus joystick yuav yog cov khoom siv sib piv. A0 thiab A1. Ntxiv mus koj yuav tsum thov 5v thiab hauv av rau Joystick.

Lub pob yog qhov me me ntawm

Hauv chav kawm no, Kuv tau siv lub khob cij me me raws li qhia hauv daim duab. Qhov no yuav tso cai rau koj lub pob khawm me me heev uas koj tsis tas yuav siv dua. Nco ntsoov tiag tiag nias lub microswitch khawm rau hauv lub khob cij, nws xav tau qee qhov siab txhawm rau txhawm rau nws.

Lub pob siv 3.3v.

Kauj ruam 3: Scripting Arduino

Scripting Arduino
Scripting Arduino
Scripting Arduino
Scripting Arduino
Scripting Arduino
Scripting Arduino

Tsab ntawv hloov pauv analog thiab digital ua ke, vim qhov no nyuaj me ntsis los ua ntawm arduino Uno. Ntawm Arduino Leonardo, nws yooj yim dua. Ob ntawm kuv tus phooj ywg programmer | Aroop Roelofs thiab Robert Popijus tau pab kuv ua qhov no ua tau.

Txhawm rau piav qhia tsab ntawv no: nws pib nrog kev txheeb xyuas cov txheej sib txawv. Koj yuav xav tau tus nqi baud ntawm 9600, qhov no txoj kev arduino tuaj yeem ua kom ncaj qha xa cov tswv yim mus rau Unity Game engine.

Tus joystick ua haujlwm nrog qhov chaw nruab nrab ntawm 512 chav nyob (koj tuaj yeem xav txog cov no ua pixels). Peb xav tau X+, X-, Y+ thiab Y- tus nqi. Qhov no yog vim li cas peb txiav txim siab 256 ntawm ob qhov kev hloov pauv axis. Txoj hauv kev no joystick cov chaw nyob nruab nrab ntawm 512, thiab tus nqi nruab nrab ntawm -1 thiab 1 tuaj yeem xa rov qab.

Cov hauv qab hauv qab no "qhov tseeb code" tsim cov lus sib txuas ua ib txoj hlua, uas yog xa mus rau Kev Sib Koom lub cav. Nws zoo li: Xvalue_Yvalue_FiringYes/Tsis yog

Lub pob yuav hais ft (hluav taws muaj tseeb) hais tias tus neeg uas ua ntawv raug tua. Txwv tsis pub nws yuav hais tias ff (hluav taws tsis tseeb)

Yog li yog tias koj tso nyiaj lub joystick me ntsis rau sab xis thiab nias lub pob tua, lub kaw lus xa qee yam zoo li 0.53_0_ft

Hauv qab yog lub cav ua haujlwm rau lub tshuab no.

Tsab ntawv tuaj yeem hloov tau, rub tawm ntawm no

Kauj Ruam 4: Txhim Kho Arcade Frame

Tsim Lub Tsev Arcade
Tsim Lub Tsev Arcade
Tsim Lub Tsev Arcade
Tsim Lub Tsev Arcade
Tsim Lub Tsev Arcade
Tsim Lub Tsev Arcade

Nov yog kauj ruam loj thiab tuaj yeem sib txawv rau koj tshaj li qhov kuv tau ua.

Koj yuav tsum tsim lub thav duab ntoo nyob ib ncig ntawm lub saib koj xav siv rau arcade.

Pib nrog kos koj lub thav duab, thiab tau txais kev ntsuas raug. Ntsuas ncig koj lub monitor kom tau txais txiaj ntsig zoo tshaj plaws. Koj yuav tsum ua lub askew angled pem hauv ntej rau koj cov arduino kom muab tso rau. Kuv siv me me 8 txog 9 centimeters tawm ntawm lub monitor. Kuv pib nrog hauv qab thiab tom qab ntawd ntxiv qee cov ntawv sab hauv thawj daim duab. Kuv ua haujlwm nrog MDF, nws yog ntoo yooj yim los tsim nrog.

Ntxiv sab nraum qab ntawm koj lub arcade, nrog MDF koj tuaj yeem siv cov ntsia hlau los khaws txhua yam ua ke. Kuv tsis tau siv cov kua nplaum, yog li kuv tuaj yeem tshem tawm cov thav duab no yog tias kuv xav hloov kho, lossis kho qee yam tom qab.

Tom qab koj ntxiv sab nraub qaum, koj yuav tsum ua lub platform rau koj lub monitor kom sawv ntsug. Koj lub ntsuas yuav tsum sawv me ntsis siab dua hauv qab ntawm tag nrho cov arcade: hauv qab yog rau koj kev tsim kho arduino.

Ntawm lub vaj huam sib luag sab saum toj, Kuv txiav tawm qee qhov txias-tav rau cua kom ntws, vim tias kuv lub ntsuas saib qub qub thiab nws yuav kub.

Ua qee qhov laj thawj loj nyob tom nraub qaum, yog li koj lub monitor HMDI/VGA thiab lub zog txuas tuaj yeem tawm.

Kauj Ruam 5: Ntxiv Arduino

Ntxiv Arduino
Ntxiv Arduino
Ntxiv Arduino
Ntxiv Arduino
Ntxiv Arduino
Ntxiv Arduino

Koj Arduino yuav tsum tau muab tso rau hauv chav ua ntej uas tawm ntawm koj lub arcade. Koj yuav tsum tsim ob lub platform rau joystick thiab khawm-breadboard los zaum. Kuv siv ob kab teeb ntawm cov ntoo thiab pom lawv tib lub kaum sab xis pem hauv ntej vaj huam sib luag nqes mus. Txoj kev no koj tus joystick thiab khawm yuav lo tawm ib yam nkaus li tag nrho lub vaj huam sib luag pem hauv ntej yuav ua.

Lub vaj huam sib luag pem hauv ntej yog qhov yooj yim haum, laum qee qhov kom koj tus joystick thiab khawm tuaj yeem tawm. Koj xav tau ob peb qhov.

Lub qhov rau koj tus joystick, ib qho rau koj lub pob, thiab lub qhov rau koj Arduino's USB cable kom lo tawm. Koj tuaj yeem tso lub qhov kawg no thiab ua roj teeb ntawm koj lub arduino yog tias koj xav tau. Koj tseem tuaj yeem ntxiv lub qhov kawg ntawm ib qho ntawm cov vaj huam sib luag sab.

Lub pob nws tus kheej qis heev thiab yuav tsis lo sab nraum koj lub vaj huam sib luag. Nrhiav lub cilinder-object, lub raj mis. Cov no feem ntau yog qhov zoo rau tus ntiv tes-khawm. Nrog superglue Kuv tau ntim lub hau thiab lo rau sab saum toj-lub hau ntawm lub pob ntawm cov ntawv uas tau ntim lawm. Tom ntej no koj tuaj yeem nyem nws rov qab ntawm koj lub khob cij lub pob. Kuv pom qee yam ntsia hlau rau kuv tus kheej thiab tsoo cov no ntawm qhov me me uas tuaj nrog chav joystick. Yog tias koj kaw kab xev rau ntawm txhua sab, nws yuav tsis tuaj yeem txav ua ke nrog lub hau khawm khawm tawm ntawm koj lub vaj huam sib luag pem hauv ntej. Thaum koj xav tias nws ua tiav, txuas koj lub arduino rau USB cable, ntxiv koj lub vaj huam sib luag pem hauv ntej thiab ntsia nws tag nrho. ua ke.

Kauj ruam 6: Rub tawm Game thiab Ua Si

Rub tawm Game thiab Ua Si!
Rub tawm Game thiab Ua Si!
Rub tawm Game thiab Ua Si!
Rub tawm Game thiab Ua Si!
Rub tawm Game thiab Ua Si!
Rub tawm Game thiab Ua Si!

Kuv tau ua game koj tuaj yeem ua si tam sim ntawd.

Nws tuaj yeem rub tawm ntawm

Txuas Arduino USB rau koj lub Laptop lossis PC, thiab txuas nrog HDMI. Thaum qhov kev ua si qhov rai tshwm tuaj, xaiv "Zaub 2" uas feem ntau yog koj li kev sib txuas saib. Yog tias siv tus saib xyuas qub thiab muaj lub khoos phis tawj tshiab dua, koj yuav xav tau VGA rau HMDI hloov pauv zoo li ntawm daim duab.

Ua si thiab txaus siab!

Pom zoo: