Cov txheej txheem:

A 4WD Neeg Hlau Tsav Los Ntawm Chaw Taws Teeb USB Gamepad: 6 Cov Kauj Ruam
A 4WD Neeg Hlau Tsav Los Ntawm Chaw Taws Teeb USB Gamepad: 6 Cov Kauj Ruam

Video: A 4WD Neeg Hlau Tsav Los Ntawm Chaw Taws Teeb USB Gamepad: 6 Cov Kauj Ruam

Video: A 4WD Neeg Hlau Tsav Los Ntawm Chaw Taws Teeb USB Gamepad: 6 Cov Kauj Ruam
Video: Providing Culturally Relevant Crisis Services (3): Cultural Responsive Factors for Hmong Population 2024, Kaum ib hlis
Anonim
Image
Image

Rau kuv txoj haujlwm neeg hlau tom ntej, Kuv raug yuam kom tus kws tsim vaj tsev/tsim kuv tus kheej lub platform neeg hlau vim qhov xwm txheej tsis tau pom dua.

Lub hom phiaj yog kom nws muaj kev ywj pheej, tab sis ua ntej, Kuv xav tau los ntsuas nws lub peev xwm tsav tsheb yooj yim, yog li kuv xav tias nws yuav yog kev lom zem sab-phiaj xwm kom coj tus yam ntxwv thiab tswj tau zoo li nws yog RC (xov tooj cua tswj) lub tsheb., tab sis hloov siv USB Gamepad.

Cov txiaj ntsig tau hais txog qhov zoo lossis zoo dua qhov kuv xav tau.

Qhov kom zoo dua ntawm kev mus rau USB Gamepad txoj hauv kev, nrog ntau txoj haujlwm, yog tias kuv tuaj yeem hloov kho nws thiab ntxiv rau qhov kuv tau ua tiav lawm. Kuv tsis muaj qhov kev paub dhau los tsim lub tsheb RC, tab sis kuv xav tias ib qho zoo nkauj heev nrog txhua yam RC tus xa tawm (joysticks/khawm, thiab lwm yam) thiab RC tus txais tuaj nrog.

Piv txwv li, Kuv tau ntxiv qee qhov kev lees paub tias tus neeg hlau tau tsoo lub phab ntsa, tsuas yog los ntawm kev muaj lub software tshawb pom qhov dej siab thiab qhov ntsuas tus lej tsawg.

Xaiv tau, ib tus tuaj yeem ntxiv qee qhov USB webcams rau tus neeg hlau, nyob ntawm seb muaj pes tsawg leej thiab lawv qhov kev tso kawm, ib tus tuaj yeem tsav tus neeg hlau nyob ib puag ncig thaj chaw nyob thiab mus rau lwm chav, thaum zaum lwm qhov ntawm lub computer uas muaj USB Gamepad txuas nrog nws.

Cov Lus Qhia no yuav tsis yog qhov tseeb, ntxaws ntxaws, txhua yam suav nrog, ib qib zuj zus yuav ua li cas-tab sis kuv yuav sim muab ntau yam kom ntxaws li kuv tuaj yeem ua tau.

Khoom siv

Cov Lus Pom Zoo: Feem ntau ntawm qhov no kuv tau txais los ntawm Servo City (Actobotics).

2 - 13.5 U -channels, rau ob sab ntawm lub hauv paus ncej. Cov motors tau teeb tsa rau qhov no. Kuv tau mus nrog qee yam luv dua thiab kuv lub cav tau teeb tsa ntawm lub ces kaum heev, thiab nws ua rau nws nyuaj rau mount lawv.

2 - 12 U -channel rau pem hauv ntej thiab tom qab ntawm lub hauv paus thav duab.

2 - 15 U -raws rau lub pob tw, pem hauv ntej thiab nram qab

2 - 7 (lossis nws yog 7.5 ?) U -channels rau kab hauv ntej. Qhov no tsis yog qhov tseem ceeb heev, qhov ntev tuaj yeem sib txawv. U-channel uas txuas ntawm lawv.

2-(ntev?) U-channels rau cov tswv cuab kaum, pem hauv ntej-rau-tom qab, txuas kab ncaj ncaj. Qhov no yog qhov tseem ceeb, vim tias Servo City / Actobotics muag 45 degree lub kaum ntse ntse los yog nkhaus rau lub hom phiaj no, tab sis koj yuav tsum ua qee qhov lej / txhais kom paub tseeb tias koj tau txais qhov ntev.

2-(ntev?) U-channel los ua haujlwm qib siab dua sab nraub qaum, dua li cov no nyob ntawm seb koj ua dab tsi nrog lub hauv paus

2-(ntev?) U-raws los ua tus qib siab dua pem hauv ntej thiab tsheb nraub qaum, ib yam teeb meem rau saum toj no.

1 - (ntev?) U -channel los ua tus tswv cuab saum toj kawg nkaus, nthuav dav hla txhua kab tom qab. Qhov no yuav tsis yog qhov tseem ceeb heev, txij li koj tuaj yeem nce saum, lossis nyob rau hauv / tom qab ntawm kab ncaj.

12 (kwv yees) L-raws lossis kab zauv. Cov no ua haujlwm rau ntau lub hom phiaj tab sis qhov tseem ceeb muab cov qauv kev ntseeg/lub zog rau cov ces kaum ntawm lub hauv paus thav duab thiab cov kab ncaj.

4 (+?) 3-qhov rau 5-qhov tiaj-raws. Cov no tseem muab cov txheej txheem muaj zog rau cov neeg hlau.

ServoCity muag ob hom tseem ceeb ntawm cov tiaj tiaj tiaj tiaj tiaj, muaj txiaj ntsig zoo rau kev siv qis hauv qab-lauj kaub, lossis sab saum toj uas koj lub roj teeb thiab lossis cov tswj yuav mus, lossis txawm tias siab dua saum npoo rau lub ntsuas cua.

Muaj 4 (4.5?) "X 12" vaj huam sib luag, thiab kuv xav tias lwm tus yog 9 (9.5?) "X 12 vaj huam sib luag.

Tam sim no qhov no yog qhov uas tau txais kev txaus siab, thiab tej zaum yuav tsis meej pem thiab kim (qhov me me ntxiv ntxiv). Txhua txoj hauv kev, thiab lwm yam, tuaj yeem txuas rau ib leeg ntawm cov txuas txuas no, uas muaj SEVERAL. Nov yog qhov uas kuv thov txim uas kuv tsis muaj cov ncauj lus ntxaws ntxaws, cov npe tshwj xeeb.

Thiab qhov yog.. koj tsis paub tiag tiag qhov twg koj yuav xav tau, lossis pes tsawg leej.. vim tias muaj ntau txoj hauv kev uas koj tuaj yeem haum cov khoom no ua ke.

Kuv tuaj yeem teev qhov kuv tau siv:

www.servocity.com/90-quad-hub-mount-c

www.servocity.com/side-tapped-pattern-moun…

www.servocity.com/90-quad-hub-mount-d

Ob qho hauv qab no yog qhov ua tau zoo heev, thiab kuv tsuas yog khaws cov no:

www.servocity.com/single-screw-plate

www.servocity.com/dual-screw-plate

Tom ntej no yog txhua tus ntsia hlau (bolts). Kuv pib nrog ib pob ntawm ib qho loj me, thiab kuv tau hla dhau ntawm lawv. Kuv siv cov ntsia hlau ntev dua qhov loj me tsis muaj teeb meem, thiab tshwj tseg qhov luv rau qhov lawv tau thov vim tias tsis muaj lwm qhov ntev yuav ua haujlwm.

Thaum kawg, koj yuav tsum tau txais 1 lub hnab ntawm cov no:

www.servocity.com/6-32-nylock-nuts-pack

Kuv tsis tau siv ntau qhov, tab sis lawv (kuv xav tias) yog qhov tseem ceeb kom ntseeg tau tias koj lub cav tsis ua rau lub cev poob qis. Tsuas yog ob leeg yuav ua haujlwm rau ib lub cav, vim yog U-channel

Koj yuav xav tau yam tsawg 4 ntawm cov no, koj yuav tau txais ib qho ntxiv lossis yog tias koj ua rau muaj kev puas tsuaj rau ib tus (ntseeg kuv, koj yuav tau tso / tshem tawm lub cav ob peb zaug):

www.servocity.com/heavy-duty-clamping-shaf…

Feem ntau, lub cev muaj zog yog 6 hli, thiab qag yog 1/4 (0.25in).

Kuv yuav tau txais qee cov ntsia hlau dub, xav tias muaj zog dua, thiab siv lawv rau cov clamps saum toj no, thiab TSIS TXHOB siv cov ntsia hlau uas los nrog cov clamps:

(Kuv xav tias cov no yog cov):

4 - 1/4 "(0.25") txoj kab uas hla

1 - hnab dub 1/4 spacers

4 - Clamping D -Hub

www.servocity.com/0-770-clamping-d-hubs

4-D-Shafts (#6340621.375 "(1-3/8")

4 - 6 lub log hnyav

www.servocity.com/6-heavy-duty-wheel

Nco ntsoov tias kuv nyiam cov log no tab sis lawv muaj cov tawv tawv tawv. Lawv zoo li ua tau zoo ntawm cov plag tsev nyuaj, thiab cov ntaub pua plag, thiab tej zaum nyuaj rau kev taug kev. Yuav tsis ua zoo ntawm nyom, xuab zeb, thiab lwm yam.

Ib qho ntxiv, lawv yuav zoo li txhuam koj cov ntaub pua plag !!!

4 - cov motors:

www.servocity.com/motors-actuators/gear-mo…

Kuv mus nrog 223 RPM, zoo sab hauv tsev nrawm, tseem tuaj yeem txav kuv tus neeg hlau (hnyav nrog 2 SLA 12V roj teeb) yooj yim heev hauv kev txav qeeb.

2 - lub cav encoders rau lub cav. (Lub Nroog Servo's Roboclaw tsuas yog ua haujlwm 2 tus lej nkag)

1 - Roboclaw 2X45A lub cev muaj zog tswj hwm, xyuas kom koj tau txais ib qho nrog lub dav hlau ntsuab thaiv ntawm nws, tsis yog tus pin …. nyob zoo … txhua tus muaj lawv qhov zoo. Hindsight.. Kuv yuav tau txais cov koob.

Kuv xav tias nws yog los ntawm Servo City.

SparkFun muag Arduino Uno (qhov kuv tau siv), thiab tseem Redboard Artemis ua koj tus thawj tswj tsav.

Koj yuav xav tau Raspberry Pi 3 (lossis 4?) Raws li koj qib siab "hlwb" thiab cuam tshuam rau koj.

Koj yuav tsum tau thaiv, hloov pauv, fuses, thiab muaj zog heev "flyback" diode.

Kuv siv Duracell 12V 14AH roj teeb sib sib zog nqus SLA roj teeb, tab sis koj tuaj yeem siv qhov twg los xij.

CEEB TOOM! Tus tsim ntawm tus neeg hlau no (TALL, thiab dav, tab sis luv), xav tias ib yam ntawm qhov hnyav nruab nrab ntawm lub ntiajteb txawj nqus, xws li SLA roj teeb yuav muab. Nws yuav tsis ua haujlwm zoo nrog lwm hom tshiab ntawm cov cuab yeej siv roj teeb tshiab. LiPo, Tsov, thiab lwm yam. Nws tuaj yeem yooj yim dua.

Los ntawm Pololu Kuv tau txais ob peb lub thoob ntsaws hloov pauv, yog li kuv tuaj yeem ua tus kheej lub zog Arduino thiab/lossis Redboard, txawm hais tias lawv yuav txuas nrog Raspberry ntawm USB, vim kuv tsis xav kom cia siab rau Raspberry lub zog. (Tshwj xeeb tshaj yog teeb tsa lub koob yees duab, lub ntsuas cua, thiab lwm yam)

Koj yuav xav tau 12-rau-5V nqis nqis tswj qhov ntsuas hluav taws xob, yam tsawg kawg 5A (?) Rau Raspberry. Lwm tus tuaj yeem tuav tau txhua yam ntawm 7 txog 15V yog li ncaj qha rau SLA roj teeb.

Qhov ntawd yog hais txog nws rau ntu.

Dab tsi kuv yuav tsis ua - 90 degree beveled gearing.

Ib zaug ntxiv, muaj ntau cov vis dis aus hauv kuv Robotics youtube playlist nthuav qhia feem ntau ntawm cov saum toj no.

Kauj Ruam 1: Kev tsim kho

Qhov tseeb, txhua yam ntawm kuv cov kev tsim kho tau ua tiav hauv daim ntawv ntawm youtubes. Koj tuaj yeem pom cov ntawd hauv kuv li Robotics playlist, pib ntawm "Wallace Robot 4". Cov yav dhau los (Wallace II, Wallace III) kuj muaj cov khoom zoo

www.youtube.com/playlist?list=PLNKa8O7lX-w…

Kauj Ruam 2: Xeem Roboclaw, Motors, thiab Encoders

Cov neeg tsim khoom ntawm Roboclaw (BasicMicro) muaj daim ntawv thov Windows uas koj tuaj yeem siv los ua kom ntseeg tau tias koj tau xaim lub cav thiab tus lej nkag mus kom raug rau Roboclaw. Koj yuav tau koom nrog cov cav tib yam ib sab ua ke nrog Roboclaw. Koj tuaj yeem xaiv siv lub xov tooj sib txuas, ntawm tsuas yog lub tsheb tom qab, lossis lub cav ua ntej, lossis tej zaum yuav zoo dua - DIAGONALLY.

Qhov laj thawj rau kuv cov lus qhia yuav tsum ua nrog (tom qab) tshawb xyuas cov neeg hlau nyam. Muaj cov xwm txheej kab pheeb ces kaum ntawm yog tias lub log pem hauv ntej/lub log tom ntej/tsis tig yuav zoo dua li nyob rau pem hauv ntej, lossis tsuas yog lub nraub qaum.

NCO TSEG: yam kuv tsis tau ua yog siv Arduino los txuas (ntawm GPIO pins) rau tus lej nkag - yog tias koj ua li ntawd, koj tuaj yeem muaj Roboclaw tuav 2 tus lej nkag, thiab tom qab ntawd muaj Arduino tuav ob qho ntxiv, thiab tsuas yog nug Roboclaw rau nws ob qhov kev ntsuas tus lej (thiab nrawm).

NCO TSEG: Kuv siv BasicMicro daim ntawv thov los teeb tsa ua ntej Roboclaw rau Ramping Up / Ramping Down. Qhov no zoo rau kev tiv thaiv kho vajtse thiab khoom siv hluav taws xob. Muaj cov vis dis aus hais txog qhov ntawd hauv kuv li Robotics playlist.

Kuv yuav luag tsis nco qab: Kuv kuj tseem yuav qee cov mos txwv-txuas cov xov txuas uas mus nruab nrab ntawm cov kab hluav taws xob, thiab Roboclaw. NCO TSEG: yog tias koj ua qhov no, koj yuav pom tias tag nrho cov kab hluav taws xob ntev tiag tiag. Tab sis kuv tsis xav tau txiav ib qho yog tias kuv tsis xav tau. Kuv tau ua (rau qib tom ntej) ntsib teeb meem kev sib txuas lus nrog USB ntawm Raspberry thiab Arduino, tej zaum vim yog EMI suab nrov.. tab sis kuv tau ua haujlwm ib puag ncig ntawd nrog software.

Yog tias nws dhau los ua teeb meem, koj tuaj yeem txiav xov hlau luv - koj tseem tuaj yeem yuav cov hlau thaiv (los ntawm Amazon, 1 txoj kab uas hla).

Qhov kawg: Qhov no kuv tseem tsis tau ua --- muaj Roboclaw pib kho lossis teeb tsa nws tus kheej (siv tus lej cim) kom ob sab laug thiab sab xis lub cav txav ntawm qhov nrawm thiab tus neeg hlau mus ncaj.

Kuv qhov nkhaus me ntsis ntau dua li 12 ko taw tab sis tsis txaus uas kuv xav tias yuav tsum ua dab tsi txog nws.

Kauj Ruam 3: Ntxiv thiab Ua Haujlwm Arduino

Koj yuav xav tau lub thoob ntsaws thiab qee qhov thaiv, kuj tseem muaj USB cable. Xyuas kom koj tau txais qhov raug rau Arduino txuas.

Koj yuav tsum rub tawm Arduino IDE.

Ntawm no ntawm Github yog qhov kev kos duab tshiab tshaj plaws uas ua haujlwm tsav lub neeg hlau:

github.com/elicorrales/wallace.robot.ardui…

Koj yuav txuas Arduino rau koj lub khoos phis tawj siv IDE, thiab raws li qhov kos duab tau sau, koj yuav siv tus pin 10 thiab 11 ntawm Arduino rau kev sib txuas lus txuas (Software Serial) nrog Roboclaw.

Kuv tsim txoj kev sib txuas lus yooj yim ntawm Raspberry Pi thiab Arduino.

Nws yog ASCII-tus cwj pwm raws, uas ua rau nws yooj yim dua debug thiab sim tsuas yog siv Arduino IDE's "serial monitor" window.

Cov lus txib pib ntawm tus lej "0" (xoom) thiab tsuas yog nce raws qhov xav tau

Cov lus txib pib hauv "20" s yog ncaj qha Roboclaw cov lus txib, thiab cov hauv qab no tus lej yog cov lus hais txog Arduino nruj me ntsis.

Vim yog EMI suab nrov, Kuv txhim kho cov lus txib kom suav nrog daim tshev nyiaj.

Yog li, txhua txoj hlua yuav suav nrog:

# tus lej tokens hauv txoj hlua nrog rau qhov no

cov checksum

Piv txwv, hais tias koj xav kom Arduino teb nrog nws cov ntawv qhia zaub mov ntawm cov lus txib:

4 0 12 16

"4" yog plaub tokens hauv txoj hlua.

"0" yog MENU hais kom ua.

"12" yog tus lej uas kuv xaiv.

"16" yog qhov sib npaug ntawm 4 + 0 + 12.

Qhov tib MENU hais kom ua yuav txawv:

4 0 20 24

Vim tias kuv tau xaiv tus lej sib txawv, daim tshev kuj tseem txawv.

Piv txwv, hais tias koj xav mus tom ntej ntawm 100 % nrawm:

5 29 0 134 100

"5" tsib tokens

"29" qhov FORWARD hais kom ua

"0" tus lej random

"134" daim tshev nyiaj

"100" qhov ntsuas 1 (qhov nrawm hauv qhov no)

Yog tias Arduino tsis tuaj yeem txheeb xyuas cov hlua uas tau nkag, nws tsuas yog tso nws / tsis quav ntsej nws, tsis muaj lus teb.

Yog tias Arduino tsis tau txais kev txav mus tom ntej nrog X milliseconds, nws xa STOP motors mus rau Roboclaw.

Arduino pib thiab pib xa nws tus kheej-xwm txheej mus rau USB chaw nres nkoj… tshwj tsis yog hais kom tsum tsis txhob ua qhov ntawd.

Txog tam sim no koj yuav tsum tau npaj los sim tswj Roboclaw thiab saib cov motors tig, tsuas yog siv "Serial Monitor" ntawm IDE.

Kauj Ruam 4: Ntxiv thiab Ua Haujlwm Raspberry Pi (node.js)

Ib zaug ntxiv, yog tias koj saib kuv li Robotics playlist, txawm tias pib los, Kuv tau hla txhua kauj ruam kom tau txais Raspberry thiab ua haujlwm.

Ib yam uas kuv yuav tau ua dhau los yog tias koj yuav xav tau 5V tus tswj hwm, thiab txawm li cas los xij tsim, txiav/hloov kho USB cable rau nws, lossis siv lub zog Raspberry lwm txoj hauv kev.

Nov ntawm Github yog txhua yam koj xav tau hauv Raspberry los sib tham nrog Arduino ntawm USB.

github.com/elicorrales/wallace.robot.raspb…

Muaj txawm tias xeem ntawv.

Koj tuaj yeem saib ntawm node.js server code thiab koj yuav pom li cas Raspberry hloov cov lus qhia terse lej, rau hauv REST-type url strings. Koj tuaj yeem siv "curl" xa cov lus txib sim.

Piv txwv:

koj RP3 IP chaw nyob: 8084/arduino/api/forward/50

yuav ua rau cov motors tig lub log rau pem hauv ntej.

Yog tias koj muab qhov ntawd tso rau hauv kab ntawv lub plhaub, koj yuav pom lub log tig mus.

Tus node.js code (server.js) suav nrog kev rov txuas dua tshiab hauv rooj plaub cov lus sib txuas tau poob rau Arduino. Koj tuaj yeem sim qhov no los ntawm kev tshem lub Arduino los ntawm Raspberry, thiab rov txuas nws.

Nco ntsoov tias koj phim tus lej baud tus nqi nruab nrab ntawm ob.

Vim tias Arduino xa cov ntawv tsis zoo ntawm cov ntaub ntawv, thiab vim tias ntawm qib node.js, thiab ntawm qhov browser qib javascript, txhua yam tau cim rau xa ntau "tsav" cov lus txib, Kuv tau tuaj yeem ua haujlwm siab li 2 000 000 baud (2 Mbps).

Yog tias koj tau txais cov ntawv xeem los khiav thiab koj pom lub log tig, tom qab ntawd koj tau npaj rau qib tom ntej.

Kauj Ruam 5: Kauj Ruam Kawg - Programming / Siv Tus Web Page Client

Suav nrog hauv Github txuas rau Raspberry feem ntawm txhua qhov no, yog cov neeg siv khoom siv.

index.html. index.js. p5.jn wb.

Lawv tuav lub USB Gamepad ntawm Gamepad API (browser-based) thiab koj yuav tsum pom cov nyees khawm sib txawv thiab cov sliders kuj muaj nyob ntawm nplooj ntawv web.

Cov lus nug javascript code (pov npav) X- thiab Y-axis qhov tseem ceeb rau ib qho ntawm joysticks.. Nws pov npav sai heev, thiab nws tua tawm tag nrho cov txiaj ntsig no rau node.js server mloog ntawm 8084.

Qhov nyoos X- thiab Y-axis qhov tseem ceeb ntawm cov joysticks yog nruab nrab ntawm 0 thiab 1.

Tab sis Roboclaw lub zog tswj lub tsev qiv ntawv ua haujlwm tau siv hauv Arduino los tsav lub cav, cia siab tias tus nqi nruab nrab ntawm -100 txog 0 (rov qab) lossis (0 txog 100) rau pem hauv ntej.

Tso…. uas yog lub hom phiaj ntawm suav nrog p5.min.js. Nws tsuas yog tshwm sim kom muaj qhov zoo nkauj heev, daim ntawv qhia yooj yim () ua haujlwm qhov twg koj muab nws tus nqi nyoos, nws nyoos (tam sim no) ntau, thiab qhov tshiab, xav tau ntau yam. Thiab nws hloov pauv tus nqi nyoos mus rau tus nqi ntawm qhov tshiab, kab ntau.

Lwm qhov taw tes: Ntawm 100 nrawm, tus neeg hlau tuaj yeem ua kom yuam kev. Kuv tau tas li khiav mus rau qee yam. Tab sis txawm tias koj tau zoo dua ntawm qhov ntawd, nws tseem kov tau thaum tig sab laug lossis sab xis.

Ib yam dab tsi rau koj ntxiv yuav zoo ib yam li Max Speed slider tam sim no ntawm nplooj ntawv web. Tus slider txiav txim siab dab tsi yog qhov siab tshaj lossis tus nqi siab tshaj uas koj yuav tau ua daim phiaj joysticks Xs thiab Ys rau.

Piv txwv:

Hais tias koj tab tom qhia 0 -> 1 txog 0 -> 100. Thaum koj thawb lub joystick nres tag, koj nyob ntawm 100. Touchy. Tej zaum yuav nrawm heev.

Tab sis, yog tias koj xaub qhov Max Speed slider rov qab me ntsis, tam sim no koj tab tom khawb 0 -> 1 txog 0 -> 80 lossis 70.

Qhov ntawd txhais tau tias koj muaj ntau txoj hauv kev txav koj tus joystick yam tsis muaj qhov hloov pauv loj hauv qhov nrawm raug xa mus rau node.js (thiab rau Arduino).

Thiab ntxiv rau koj tuaj yeem ua yog cais Xs (tig sab laug lossis sab xis) los ntawm Ys (rau pem hauv ntej lossis rov qab) rau hauv lawv tus kheej qhov nrawm tshaj plaws.

Yog li, koj tuaj yeem tawm ntawm Ys ntawm 0 txog 100, 0 txog -100 rau kev tawm suab nrawm, tab sis qis Xs qhov nrawm tshaj plaws rau kev tswj kev txav mus los ntau dua. Qhov zoo tshaj plaws ntawm ob lub ntiaj teb.

Kauj Ruam 6: Tsis teb los tau: Tsav Neeg Hlau Nrog Mouse Drag thiab / lossis Kov Cov Txheej Txheem

Yog tias koj tau txais qhov no deb, koj paub tias cov txheej txheem software pib los ntawm qhov browser thiab kev nqis los ntawm Javascript thiab mus rau Raspberry node.js server, thaum kawg mus rau arduino, yog hloov Gamepad joystick X- thiab Y-coordinates rau hauv " rau pem hauv ntej "(lossis" rov qab ", thiab lwm yam) cov lus txib (thiab lawv tus nqi nrawm).

Ntxiv mus, koj paub tom qab ntawd thaum lub joysticks 'Xs thiab Ys tsis zoo 1, dhau xoom, mus rau ntxiv 1, cov ntawd yuav tsum tau hloov pauv ntawm xoom thiab 100. Zoo, qhov siab nyob ntawm qhov siab tshaj plaws teeb tsa ntawm nplooj ntawv web.

Soo … qhov tsuas yog ua kom siv tus nas, lossis kov cov xwm txheej (zoo li ntawm lub xov tooj smartphone), yog txhawm rau ntes cov xwm txheej no, tuav Xs thiab Ys.

TAB SIS ---- cov Xs thiab Ys tsis yog nruab nrab ntawm qhov tsis zoo 1 thiab 1. Lawv pib 0 thiab nce ntxiv, vim tias lawv yeej yog cov pixels lossis cov txheeb ze sib txheeb ntawm qee qhov HTML ntsiab lus (xws li lub khau raj khau raj) lossis daim ntaub.

Yog li muaj dua, P5's Js lub tsev qiv ntawv "daim ntawv qhia ()" ua haujlwm tau yooj yim heev los rov ua daim duab qhia rau qhov peb xav tau.

Kuv rov kho dua cov cai kom muaj ob nplooj ntawv sib txawv, ib qho rau desktop siv Gamepad, lwm qhov rau mobile, siv cov xwm txheej kov.

Tsis tas li, ib zaug Xs thiab Ys tau rov ua dua tshiab, lawv tau pub rau tib txoj cai ntawm cov lej, thiab lwm yam, ib yam li Xs thiab Ys los ntawm Gamepad.

Pom zoo: