Cov txheej txheem:
- Kauj Ruam 1: Hooking Up Control Buttons rau Arduino
- Kauj Ruam 2: Coding Arduino Leonardo:
- Kauj ruam 3:
- Kauj ruam 4:
- Kauj ruam 5:
- Kauj Ruam 6:
- Kauj ruam 7:
- Kauj Ruam 8: Coding Movement in Unity:
- Kauj ruam 9:
- Kauj ruam 10:
- Kauj ruam 11:
- Kauj ruam 12:
- Kauj ruam 13:
- Kauj Ruam 14: Nqis Teeb Rau Arduino
- Kauj Ruam 15: Coding Arduino Uno
- Kauj ruam 16:
- Kauj ruam 17:
- Kauj Ruam 18: Coding Teeb Kev Sib Koom Sab:
- Kauj ruam 19:
- Kauj ruam 20:
- Kauj ruam 21:
- Kauj ruam 22:
- Kauj ruam 23:
- Kauj Ruam 24:
Video: Arduino Game Controller With Lights Response to Your Unity Game :: 24 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Ua ntej tshaj kuv tau sau qhov no los ntawm lo lus. Nov yog thawj zaug kuv siv cov lus qhia yog li thaum twg kuv hais: sau cov lej tawm zoo li paub tias kuv hais txog cov duab nyob rau saum toj ntawm cov kauj ruam ntawd.
Hauv qhov haujlwm no kuv siv 2 arduino's los khiav 2 cais cov lej txij li kuv muaj teeb meem tau txais nws ua haujlwm nrog tsuas yog ib qho
Cov no yog Uno thiab Leonardo
tag nrho qhov no yog qhov koj yuav xav tau los ua daim phiaj rau qhov haujlwm no.
· 7 lub laub khawm
· 23 jumper xov hlau
· 1 arduino Leonardo + usb cable
· 4 tus tiv thaiv · 4 tus coj
· 1 arduino uno + usb cable
· 2 daim ntawv qhia zaub mov
Kauj Ruam 1: Hooking Up Control Buttons rau Arduino
Dab tsi koj yuav xav tau los txuas qhov ntu no:
· 7 lub laub khawm
· 14 jumper xov hlau
· 1 arduino Leonardo + usb cable
· Khob cij
Cov nyees khawm tau yooj yim zoo nkauj los sib txuas tab sis tuaj yeem dhau los ua qhov tsis zoo los tso saib hauv daim duab.
· Thawj ntawm koj tso lub laub khawm hauv cov haujlwm kuv cim rau ntawm daim duab saum toj no.
· Qhov thib ob koj xav nqes tus jumper los ntawm qhov av hauv av ntawm arduino Leonardo mus rau qhov rho tawm kab ntawm lub khob cij.
· Tam sim no koj nqes tus dhia los ntawm txhua qhov chaw ntawm qhov rho tawm kab rau kab uas nyob nrog kab sab xis ntawm koj nias lub pob. qhov no yuav muab lub zog rau nws.
· Tom ntej no koj xav nqes ib lub xaim xaim xaim los ntawm kab uas nyob hauv kab nrog tus pin sab laug ntawm koj lub laub khawm mus rau Leonardo cov cuab yeej siv digital. Rau cov nyees khawm ntawm no kuv siv qhov 2 - 3 - 4 - 5 - 6 - 7- 8
Kuv tsuas yog qhia cov xaim mus rau cov tswv yim 8 ntawm daim duab ua rau nws dhau mus ua daim duab tsis zoo los qhia koj txhua txoj xov hlau hla ib leeg.
Kauj Ruam 2: Coding Arduino Leonardo:
Yog li qhia koj qhov laj thawj uas kuv siv Leonardo rau qhov no. Nws yog vim nws muaj qee qhov nti uas Uno tsis ua uas ua rau lub khoos phis tawj lees paub nws ua lub cuab yeej siv USB. Zoo li Nws xav tau cov keyboard. Uas tso cai rau peb ua qee yam uas ua rau peb lub neej zoo li programmers rau qhov haujlwm no yog ntuj raug txim uas yooj yim dua. Keyboard emulation. Peb yuav dag lub khoos phis tawj mus rau hauv kev xav tias peb tau nias qee lub yuam sij ntawm cov keyboard thaum peb nyob hauv qhov tseeb nias cov nyees khawm ntawm peb tus tswj.
Tam sim no kuv yuav taug kev koj xav tias txoj cai ib qib zuj zus.
Ua ntej tshaj txhua txoj hauv kev saum peb suav nrog Keyboard.h. Qhov no yuav tso cai rau peb siv cov haujlwm keyboard uas peb yuav siv hauv peb cov cai.
Kauj ruam 3:
Tom qab ntawd peb yuav tsum tau txheeb xyuas qhov digital input slots peb yuav siv los ntawm
Leonardo rau txhua lub khawm.
Kuv kuj tseem muaj npe txhua tus ntawm lawv tom qab tus yuam sij kuv yuav ua raws.
Kauj ruam 4:
Los ntawm qhov ntawd peb nkag mus rau qhov teeb tsa teeb tsa. Qhov no qhia rau
arduino nws ua dab tsi thaum pib.
ua ntej peb sau Serial.begin uas yuav qhib qhov chaw nres nkoj txuas thiab teeb tsa cov ntaub ntawv tus nqi mus rau 9600 bps
thiab peb txhais tag nrho cov npe pins los ua tswv yim.
Kauj ruam 5:
Thiab thaum kawg peb sau peb lub voj kev ua haujlwm uas yuav txheeb xyuas yog tias
cov nyees khawm tau raug nias thiab qhia rau arduino yuav teb li cas rau qhov ntawd.
Ua ntej peb sau Keyboard.begin uas yuav qhia rau arduino tias nws xav tau los saib xyuas rau peb siv cov keyboard ua haujlwm
Kauj Ruam 6:
Tom qab ntawd rau txhua lub pob peb sau ib qho yog/lwm nqe lus uas zoo li qhov no
Yog li qhov kuv hais rau arduino ntawm no yog: Yog tias kuv sab laug khawm raug kev nyuaj siab ntawm tus tswj hwm ua rau lub khoos phis tawj xav tias peb tab tom nias tus "a" tus yuam sij thiab yog tias tsis yog rooj plaub ua rau nws xav tias peb tau tso tus yuam sij tseg.
Koj ib txwm rov ua qhov thaiv ntawm cov cai rau txhua lub pob ntawm koj tus tswj. nrog kev hloov pauv rau txhua qhov sib txawv thiab cov yuam sij uas sib txawv xav tau kom ua raws
Kauj ruam 7:
Cov yuam sij peb hais qhia rau lub khoos phis tawj ntaus ntawm no yog W - A - S - D uas
zoo nkauj npaum li tus txheej txheem rau kev txav chaw hauv pc game thiab E-Q-thiab thaj chaw uas nyob hauv cov cai no tau lees paub tias yog '' uas yog cov nyees khawm kuv siv tuaj tos-tso thiab tua hluav taws hauv kuv qhov kev ua si. Xav tias hloov pauv cov no rau cov yuam sij twg koj xav tias ua haujlwm zoo dua rau koj cov game/maub los.
Thaum kawg peb qhia rau arduino kom tsis txhob kos qhov Keyboard.end
Kauj Ruam 8: Coding Movement in Unity:
Ua ntej tshaj cia kuv qhia koj tias kuv ua qhov no rau 2d game li
cov piv txwv uas koj yuav pom tau tsim rau qhov ntawd. Feem ntau lub ntsiab lus qhov twg kuv siv vector2's yog tias koj ua haujlwm hauv 3d koj yuav siv vector3's. vim tias koj yuav tsum tau txhawj xeeb txog kuv qhov kev txav mus los ntxiv hauv 3d.
Tam sim no yog vim li cas kuv siv Keyboard ua raws ntawm arduino sab yog vim Kev sib sau muaj qee yam tsim los kom paub cov yuam sij ntawm cov keyboard uas peb tuaj yeem siv tau.
Yog tias koj qhib koj txoj haujlwm hauv kev sib koom ua ke mus rau Kho kom raug -> Cov phiaj xwm teeb tsa -> Tswv yim. Koj tuaj yeem pom hauv koj tus kws tshuaj xyuas nws khau rau tus thawj tswj xyuas tswv yim. Qhov twg yog tias koj nyem rau Axes koj tuaj yeem pom tag nrho cov npe ntawm cov npe nkag qhib uas ib txwm siv rau cov tswj hwm pc zoo li cov uas peb tab tom ua tam sim no. 2 cov tswv yim peb yuav siv yog Kab Rov Tav thiab Ntsug uas txheeb xyuas rau koj kwv yees nws W-A-S-D.
Ua ntej koj xav ua tus kwv nyob hauv koj qhov kev sib koom ua yeeb yam hierarchy uas yuav yog koj tus neeg ua si. Hauv kuv qhov xwm txheej yog tus txiv leej tub lom zem no. Qhov no tuaj yeem yog txhua yam koj xav tau nws yuav yog tab sis rau lub hom phiaj ntawm kuv qhov kev ua si Kuv tau ua tus txiv neej no.
Kauj ruam 9:
Koj xav muab tus neeg ua si no 2 yam. Ib lub thawv collider 2d thiab
a Rigidbody 2d thiab kho lawv kom zoo li cov duab saum toj no.
Kauj ruam 10:
Tom qab ntawd koj xav mus rau hauv koj cov phiaj xwm phiaj xwm thiab tsim a
C# tsab ntawv. Uas kuv hu ua PlayerMovement.
Hauv tsab ntawv no koj yuav txiav txim siab 2 qhov sib txawv. Cov pej xeem ntab uas kuv hu ua moveSpeed. Uas yuav txiav txim siab koj yuav mus sai npaum li cas. Thiab tus kheej Rigidbody2D uas kuv hu ua RigidPlayer. Uas yuav saib rau koj cov players rigidbody.
Tsis txhob hnov qab tau txais koj tus kws kho mob sib koom nyem rau ntawm koj tus neeg ua si ntxiv cov ntawv tshiab no los ntawm rub nws mus rau tus kws tshuaj xyuas thiab teeb tus lej tus lej rau moveSpeed.
Kauj ruam 11:
tam sim no hauv koj Pib () koj xav ua ib yam thiab qhov ntawd yog
xyuas kom tseeb tias koj RigidPlayer tuaj yeem pom koj tus neeg them nyiaj rigidbody 2d. Koj ua qhov ntawd nrog kab kab hauv qab no:
Kauj ruam 12:
Tom qab ntawd peb txav mus rau qhov hloov tshiab (). Nov yog qhov peb yuav mus
kom cov neeg uas ua ntawv txav mus.
peb ua qhov ntawd nrog qhov yooj yim zoo yog kab lus uas yuav saib qhov tsis zoo thiab cov yuam sij los ntawm Kab Rov Tav (AD) thiab Ntsug (SW) thiab siv qhov ntawd los ua tus lej txhawm rau yuam peb yuav tso rau ntawm peb lub cev nruj 2d txhawm rau thawb peb cov neeg ua si kev taw qhia. Tus lej ntawd yuav muab sib tw los ntawm kev txav txav mus los.
Kauj ruam 13:
Thaum kawg koj xav kom paub tseeb tias koj cov neeg ua si tsis txav mus thaum twg
koj tsis nias dab tsi. Koj nyiam qhov no:
Tam sim no yog tias koj xav siv koj 3 lwm cov nyees khawm rau txhua yam uas koj ua nrog qhov no yog nqe lus: yog (Input. GetKeyDown (Keycode. Space))
rau qhov chaw seem thiab hloov chaw sau tsab ntawv ntawm lwm tus yuam sij uas koj xaiv los siv rau lwm tus yuam sij.
Kauj Ruam 14: Nqis Teeb Rau Arduino
·
Dab tsi koj yuav xav tau los txuas qhov ntu no:
· 9 jumper xov hlau
· 4 resistors
· 4 lwd
· 1 arduino uno + usb cable
· Khob cij
Kev sib txuas rau lub teeb yuav ua tiav los ntawm Uno.
Nws yuav xaus zoo li cov duab saum toj no:
Koj nqes cov resistors mus rau sab ntev ntawm LED's. Thiab tom qab ntawd koj txuas tus jumper los ntawm tus lej tus lej tus lej ntawm uno rau tus tiv thaiv. Hauv qhov no kuv tau siv tus lej pin tus lej 9 -10 -11 -12 cov lej no yuav muaj feem cuam tshuam thaum peb mus txog qhov chaws rau teeb.
Los ntawm qhov ntawd koj xav nqes ib lub jumper los ntawm qhov av hauv av ntawm koj arduino Uno mus rau qhov chaw ntawm koj lub rooj tsavxwm raws li pom nrog cov xaim dub ntawm daim duab saum toj no.
Tom qab ntawd koj xav kom muaj 4 tus dhia dhia txhua tus coj mus rau qhov luv luv ntawm txhua LED
Kauj Ruam 15: Coding Arduino Uno
Zoo ua ntej ntawm peb tab tom yuav txhais peb cov kev hloov pauv ntxiv
Yog li ua ntej twg cov tswv yim digital peb siv rau peb lub teeb. Thiab peb yuav ua tus char hu ua myCol [20]
Kauj ruam 16:
Tom qab ntawd hauv kev teeb tsa peb xav ua Serial.begin dua. Muab tag nrho peb cov LED tso tawm thiab tig tag nrho lawv thaum pib.
Kauj ruam 17:
Thiab thaum kawg koj xav sau koj lub voj kev ua haujlwm.
Qhov no yuav ua rau Arduino nyeem hauv cov ntaub ntawv twg los hauv cov ntawv txuas mus txog thaum ib ntawm ob qhov xwm txheej tshwm sim. Ob qho kab cim tus cwj pwm raug kuaj pom; qhov no tau txheeb xyuas los ntawm lf uas tau teeb tsa 10 thiab yog thawj qhov kev sib cav lossis qee qhov nyiaj ntawm bytes tau nyeem hauv. Qhov no yog qhov kev sib cav zaum thib peb thiab rau qhov piv txwv no tau teeb tsa tsuas yog ib byte. Cov ntaub ntawv khaws cia hauv qhov sib txawv myCol, uas tau teeb tsa rau char thiab txwv ntawm 20. Hauv readBytesUntil qhov no yog qhov kev sib cav zaum ob. Los yog lwm txoj hauv kev los piav qhia nws yog Serial.readBytesUntil (terminatorCharacter, buffer, byteLimit);
Thiab yog tias nqe lus yuav ua kom ntseeg tau tias qee lub teeb qhib thaum kev sib koom ua lub teeb liab. Hauv qhov no kuv tau txais 4 lub teeb xim sib txawv yog li kuv ua kev sib koom xa g rau lub ntsuab LED kom qhib, b rau lub xiav LED kom qhib, r rau lub teeb liab liab kom qhib thiab y rau lub teeb daj daj kom qhib.
Kauj Ruam 18: Coding Teeb Kev Sib Koom Sab:
Oke 2 yam ua ntej ua ntej peb nkag mus rau qhov no.
1. hauv koj li program arduino coding mus rau Tool -> Port -> thiab kos rau kuv uas COM koj uno nyob. Hauv kuv qhov xwm txheej nws COM3 (qhov no yuav yog qhov tseem ceeb hauv txoj cai)
2. hauv kev sib koom mus rau Kho kom raug -> Teeb tsa qhov project -> Neeg uas ua ntawv tom qab ntawd hauv tus kws tshuaj ntsuam nyem rau lwm qhov chaw mus rau Api qib sib xws thiab Hloov nws los ntawm. NET 2.0 subnet rau xwb. NET 2.0
Ok uas ua tiav. Cia peb nkag mus rau hauv.
Txoj cai nyem rau ntawm koj lub hierarchy thiab nyem rau ntawm Tsim khoob.
Qhov no yuav yog qhov khoom ua si khoob uas yuav muaj nyob hauv koj cov game kom tuav ib tsab ntawv rau peb. Kuv tau hu qhov khoom no Init.
Kauj ruam 19:
Tom qab ntawd nkag mus rau koj cov phiaj xwm tab thiab tsim tsab ntawv C# tshiab
thiab hu nws Xa.
Thawj qhov koj ua yog sau cov kab no rau hauv kab lus siv koj cov cai:
siv System. IO. Ports;
siv System. Threading;
qhov no ua rau nws yog li peb tuaj yeem siv SerialPort sib txawv
Kauj ruam 20:
hauv tsab ntawv no peb yuav ua qhov hloov pauv hauv qab no. Tam sim no nco ntsoov kuv tau txais COM3 muaj qhov no yuav txawv rau koj raws li peb tau tham thaum pib ntawm cov kauj ruam no. Yog tias nws tau hloov 3 nrog tus lej nws hais rau koj.
Kauj ruam 21:
Thaum pib peb qhia cov ntawv kom siv yog OpenConnection
muaj nuj nqi uas peb yuav tau sau me ntsis
qhov hloov tshiab yog qhov kev sim ntau dua tom qab ntawd txhua yam tab sis yog tias koj xav suav nrog nws nws los ntsuas cov lus raug xa mus rau kev sib koom siab. Koj tuaj yeem tsis quav ntsej nws ncaj ncees.
Kauj ruam 22:
Oke tam sim no rau qhov OpenConnection muaj nuj nqi. Qhov no tsuas yog qhov loj
yog/lwm nqe lus uas ua rau qhib kev sib txuas tsuas yog luam nws zoo li sau thiab koj yuav tsum ua zoo.
Kauj ruam 23:
Tam sim no Nco ntsoov los ntawm tus lej arduino uas kuv tau ua rau nws tshawb xyuas
qhia tias kev sib koom siab yuav xa mus rau nws.
zoo qhov no yog qhov uas tshwm sim. Hauv kuv qhov xwm txheej kuv tau 4 lub teeb sib txuas yog li kuv tau sau 4 lub zog uas yooj yim heev. Txhua yam lawv ua yog thaum lawv raug hu lawv xa tsab ntawv mus rau arduino. Thaum arduino tau txais tsab ntawv ntawd nws teeb lub teeb sib xws rau tsab ntawv ntawd.
Kauj Ruam 24:
Koj yuav xav tsis thoob tias kuv yuav hu nws li cas
muaj nuj nqi? Zoo koj ua nws nrog ib kab yooj yim hauv ib qho ntawm koj lwm c# cov ntawv uas koj siv rau koj kev ua si. Sending. NameFunctionhere (); Yog li piv txwv hauv kuv qhov kev ua si tus neeg ua si tau ua lub luag haujlwm los sau 4 xim orbs. Yog li kuv tau sau tsab ntawv me me uas ua kom ntseeg tau tias thaum nws tau nyob ze rau ib qho thiab nias lub pob kom raug nws khaws nws thiab nws xa lub teeb liab mus rau arduino tias hauv qhov xwm txheej no lub orb daj tau tuaj tos. Yog li nws paub, ok kuv yuav tsum tig lub LED daj:
Koj tuaj yeem tso kab no ib kab ntawm txhua qhov chaw koj nyiam. Yog tias koj xav kom nws pom thaum qhov kev ua si pib muab tso rau hauv qhov pib ua haujlwm. Xav kom nws pom thaum nws tuag muab tso rau hauv koj txoj haujlwm rau cov neeg ua si tuag. Sim ib puag ncig me ntsis. Kuv xaiv ua kom lub teeb zoo ib yam ntawm ui sab nraud ntawm qhov kev ua si kom taug qab cov orbs koj tau txais los sau yam tsis muaj kev cuam tshuam ntawm lub vijtsam.
Pom zoo:
2D Video Game With C# on Unity: 4 Kauj Ruam
2D Video Game With C# on Unity: Txoj haujlwm no tau pib thaum kuv thawj zaug tau txais kuv lub PC thaum Lub Kaum Ib Hlis. Nws tau pib ua txoj hauv kev lom zem kom kawm paub txuj ci tshiab, thiab dhau los ua ib qho kuv nyiam tshaj plaws. Kuv tau ua haujlwm rau nws txij li ntawd, thiab tau teev nyob rau ntau dua 75 teev ntawm tag nrho lub sijhawm ua haujlwm
Arduino Rhythm Game Controller (rau Kuv Tus Kheej Game): 6 Kauj Ruam
Arduino Rhythm Game Controller (rau Kuv Tus Kheej Game): Hauv cov lus qhia no kuv yuav qhia koj li cas kuv tsim qhov Rhythm Game Controller los ntawm kos. Nws cuam tshuam nrog kev txawj ntoo ntoo yooj yim, kev txawj 3D luam ntawv yooj yim thiab cov txuj ci yooj yim soldering. Koj tuaj yeem zaum tsim txoj haujlwm no ua tiav yog tias koj muaj xoom ex
Arduino Raws DIY Game Controller - Arduino PS2 Game Controller - Ua Si Tekken Nrog DIY Arduino Gamepad: 7 Kauj Ruam
Arduino Raws DIY Game Controller | Arduino PS2 Game Controller | Ua Si Tekken Nrog DIY Arduino Gamepad: Nyob zoo cov neeg, ua si game yog ib txwm lom zem tab sis ua si nrog koj tus kheej DIY kev cai game Controller yog kev lom zem dua.Yog li peb yuav ua tus tswj kev ua si siv arduino pro micro hauv cov lus qhia no
Galvanic Skin Response (GSR): 3 Kauj Ruam
Galvanic Skin Response (GSR): Galvanic Skin Response Sensor (GSR - Sweating) tso cai rau koj ntsuas qhov ntsuas hluav taws xob ntawm daim tawv nqaij. Kev xav zoo yuav txhawb koj lub paj hlwb, uas ua rau cov qog hws tsim tawm hws ntau dua. GSR tuaj yeem txheeb xyuas qhov muaj zog no
Arduino Game Controller + Game Unity: 5 Kauj Ruam
Arduino Game Controller + Game Unity: Hauv cov lus qhia no kuv yuav qhia koj li cas tsim/program a arduino game controller uas tuaj yeem txuas rau kev sib koom siab