Cov txheej txheem:

USB Paddle Game Controller: 7 Kauj Ruam (nrog Duab)
USB Paddle Game Controller: 7 Kauj Ruam (nrog Duab)

Video: USB Paddle Game Controller: 7 Kauj Ruam (nrog Duab)

Video: USB Paddle Game Controller: 7 Kauj Ruam (nrog Duab)
Video: ЭТО ИДЕАЛЬНО - MOZA R5 | ОБЗОР DIRECT DRIVE РУЛЯ ОТ МОЗА 2024, Kaum ib hlis
Anonim
USB Paddle Game Controller
USB Paddle Game Controller
USB Paddle Game Controller
USB Paddle Game Controller
USB Paddle Game Controller
USB Paddle Game Controller

Kuv tus tub tau rov ua yeeb yaj kiab ua si hmo ntuj rau nws lub hnub yug, thiab thaum sawv ntxov ntawm hnub kuv txiav txim siab saib seb kuv puas tuaj yeem ua ob khub USB duav game tswj rau Pong nrog kev pab ntawm lub tshuab luam ntawv 3D thiab khoom siv hluav taws xob los ntawm kuv lub stash. Thaum kuv tau tswj kom tau txais lawv ua haujlwm tau raws sijhawm, tib neeg tsis khoom nrog lwm cov kev ua si rau Pong thaum kawg.

Cov tswj hwm tuaj yeem siv rau Pong nrog DICE Circuit-emulator qib lossis nrog kuv qhov ncaj ncees pygame version, rau Atari 2600 kev ua si nrog tus emulator, thiab rau Etch-a-Sketch-like functionality nrog cov xim tha xim xws li Tux Paint.

Muaj peb hom kev hloov pauv tau:

  • Stelladaptor paddle emulation: lawv yuav tsum ua haujlwm nrog txhua Atari 2600 emulation software uas txhawb nqa Stelladaptor; hauv Stelladaptor hom, paddles ua haujlwm li ob-axis ob-khawm joystick, txhua tus duav tswj ib txoj kab thiab ib lub pob
  • dual joystick emulation: txhua tus duav ua haujlwm raws li joystick nrog ib lub pob (nrog lub duav txav txhais mus rau txav ntawm ob lub joystick axes)
  • nas: txhua tus duav tswj ib qho kev taw qhia ntawm kev txav mus rau tus nas kiag, thiab cov nyees khawm yog nas khawm; ua ke nrog kev pleev xim koj tuaj yeem tau txais cov cuab yeej siv thev naus laus zis zoo ib yam li Etch-a-Sketch.

Khoom siv

Koj yuav xav tau:

  • stm32f103c8t6 ntsiav tshuaj xiav
  • 2x linear potentiometer (Kuv xav kom 20K-100K)
  • 2x 12mm-dav microswitch nrog khawm
  • 3D tshuab luam ntawv
  • ua tsis tau zoo (filament, xov hlau, solder, soldering hlau, kub kua nplaum)

Kauj Ruam 1: Npaj Pawg Thawj Coj thiab Arduino Ib puag ncig

Npaj Board thiab Arduino Environment
Npaj Board thiab Arduino Environment
Npaj Board thiab Arduino Environment
Npaj Board thiab Arduino Environment
  1. Muab cov xaum rau hauv taub hau nruab nrab ntawm koj lub rooj tsavxwm stm32f103c8t6.
  2. Txheeb xyuas qhov tsis kam ntawm A12 thiab 3.3V. Nws yuav tsum yog 1.5K rau kev ua kom tiav USB sib xws. Ntau lub laug cam muaj 10K hloov chaw. Yog tias koj yog ib tus ntawm cov no, cov tswv yim zoo hauv 1.8K resistor los ntawm A12 txog 3.3V, txawm hais tias koj yuav muaj hmoo thiab muaj koj lub khoos phis tawj ua haujlwm nrog 10K.
  3. Nruab ib lub bootloader. Muaj cov lus qhia hauv Kauj Ruam 2 ntawm Cov Lus Qhia no. Ib yam uas yuav tsum nco ntsoov yog qhov loj npaum li cas qhia los ntawm STM Demonstrator yog. Yog tias nws yog 32K, koj muaj qhov cuav stm32f103c8 uas yog tej zaum yuav rov tsim dua stm32f103c6. Txoj haujlwm no tseem yuav tsum ua haujlwm nrog qhov ntawd, tab sis sau tseg tias koj muaj daim ntawv tsis raug cai rau qib tom ntej.
  4. Nruab Arduino, Arduino Zero thiab Roger's libmaple-based core ua raws cov lus qhia hauv Kauj Ruam 3 ntawm Cov Lus Qhia uas koj siv hauv qib dhau los. Tsis quav ntsej cov lus qhia hauv tsev qiv ntawv hauv cov kauj ruam ntawd.
  5. Rub tawm qhov kev tso tawm tshiab tshaj plaws ntawm kuv lub USB Composite library thiab unzip nws hauv koj phau ntawv Arduino/Libraries.
  6. Rub tawm kuv tus paddlecontrollers kos duab thiab unzip nws hauv koj daim ntawv Arduino.
  7. Hauv Arduino, mus rau Cov Cuab Yeej | Pawg thawj coj saib | Generic STM32F103C Series, tshwj tsis yog tias koj muaj c6 pawg thawj coj cuav, hauv qhov xwm txheej twg xaiv Generic STM32F103C6/cuav STM32F103C8 hloov. Yog tias koj tsis paub meej tias koj muaj, xaiv qhov kev xaiv cuav yog qhov muaj kev nyab xeeb dua.

Kauj ruam 2: Upload

Upload
Upload

Txuas lub rooj tsav nkoj rau hauv koj lub khoos phis tawj USB adapter, ntsaws lub pluaj tswj tus duab, thiab nyem lub pob Upload (txoj cai taw tes xub). Yog tias txhua yam mus tau zoo, daim duab yuav tsum tso tawm, thiab pawg thawj coj yuav tsum tshwm ntawm koj lub khoos phis tawj ua ob-axis ob-khawm joystick hu ua "Stelladaptor". Hauv Windows, koj tuaj yeem txheeb xyuas qhov no nrog Windows-R, joy.cpl [nkag mus].

Tau kawg, qhov no yuav tsis ua dab tsi txog thaum koj muaj cov khoom kho vajtse sib dhos tas.

Kauj ruam 3: Luam tawm

Luam
Luam
  1. Rub tawm cov stl thiab/lossis cov ntaub ntawv scad los ntawm kuv nplooj Thingiverse rau qhov haujlwm no. Thov nco ntsoov tias lub duav duav tau hloov kho los ntawm no.
  2. Yog tias koj lub tsev me me qhov dav sib txawv ntawm 12mm, koj yuav tsum tau kho lub pob dav dav qhov ntsuas hauv cov ntaub ntawv paddlemain-standalone.scad. Koj tuaj yeem ua qhov ntawd hauv OpenSCAD lossis hauv Thingiverse Customizer.
  3. Koj yuav xav tau hloov kho qhov ntsuas hauv cov ntaub ntawv paddleknob.scad kom haum koj lub peev xwm.
  4. Luam cov ntaub ntawv no (tsuas yog luam ib daim ntawm "2x" cov ntaub ntawv yog tias koj tsuas xav tau ib lub duav xwb). Kuv siv PLA, tab sis ABS yuav tsum ua haujlwm zoo, ib yam nkaus.

    • 2 x paddlemain.stl
    • 2 x paddleknob.stl
    • 1 x paddleconverter.stl
    • 1 x pcbholdernarrower.stl
    • 2x buttoncap110.stl (yeem)
    • 1x 12.stl (xaiv tau; luam tawm hauv cov xim sib txawv thiab lo rau ntawm daim ntawv lo ob lub duav)

Kauj ruam 4: Kev thaiv kab

Thaiv
Thaiv
Thaiv
Thaiv
Thaiv
Thaiv

Koj yuav tsum tau khiav plaub lub xov hlau los ntawm stm32f103c pawg thawj coj rau txhua tus duav tswj. Koj tuaj yeem siv cov hlua USB qub rau cov xov hlau no. Kuv tau tshwm sim kom muaj cov xov hlau zoo nyob ib leeg los ntawm cov xov tooj ethernet uas kuv tau khi ua ke nrog qhwv qhwv.

Txhua tus duav muaj ib lub microswitch thiab ib lub hwj chim. Siv lub ntsuas ntsuas los txheeb xyuas ib khub uas nyob ib sab (tsis yog kab pheeb ces kaum) ntawm microswitch uas txuas nrog/txuas nrog los ntawm nias lub pob. Kuv yuav sau cov pins S1 thiab S2 hauv daim duab. Peb tus pin ntawm lub potentiometer kuv tau sau P1, P2 thiab P3 los ntawm sab saum toj mus rau hauv qab, saib los ntawm sab hauv qab ntawm lub hwj chim, nrog tus pin taw tes rau sab xis.

Thawb plaub lub xov hlau los ntawm lub rooj tsavxwm hla lub qhov rau sab ntawm lub tsev duav (paddlemain.stl).

Thaum txuas cov xov hlau mus rau microswitch, xub thawb cov xov hlau los ntawm lub qhov nyob rau sab ntawm lub tsev duav thiab txuas rau qhov hloov pauv thaum qhov hloov pauv nyob sab nraud ntawm lub tsev. Tom qab ntawd rub qhov hloov mus rau lub tsev, ua rau tus pin thiab cov xov txuas txuas haum rau hauv lub qhov. Kuv txiav cov pins uas tsis tsim nyog.

Ob leeg paddles:

  • P1 to S1
  • P1 rau board 3.3V (3.3)
  • P3 rau board GND (G)

Duav 1:

  • P2 rau board A1
  • S2 rau board A2

Duav 2:

  • P2 to pawg A3
  • S2 rau board A4

Tam sim no sim cov kev sib txuas los ntawm kev txuas rau koj lub khoos phis tawj thiab siv txoj kev ntsuas joystick. Ntawm qhov rais, Windows-R, joy.cpl [nkag mus], xaiv Stelladaptor, nyem rau ntawm Properties. Paddle 1 yuav tsum tswj X-axis thiab khawm thawj; duav 2 yuav tsum tswj Y-axis thiab khawm thib ob.

Kauj Ruam 5: Rooj Sib Tham Kawg

Los Ua Ke Kawg
Los Ua Ke Kawg
Los Ua Ke Kawg
Los Ua Ke Kawg
Los Ua Ke Kawg
Los Ua Ke Kawg
Los Ua Ke Kawg
Los Ua Ke Kawg

Cov microswitches tuaj yeem muab lo (cov kua nplaum kub tau ua txoj haujlwm rau kuv) hauv lawv qhov chaw nyob ntawm ib sab ntawm lub thawv duav. Khawm khawm tuaj yeem raug kaw, nrog me ntsis ntawm cov kua nplaum kub kom ruaj khov.

Lub potentiometer txuas rau lub qhov loj nyob rau sab saum toj ntawm lub thawv duav. Lub pob qhov rooj yuav tsum swb thiab lo rau. Nthuav qhov nrog xyaum raws li xav tau. Thawb lub hauv qab npog rau, ntxiv me ntsis ntawm cov kua nplaum kub yog tias koj nyiam.

Cov ntsiav tshuaj xiav haum rau sab hauv PCB swb, uas tom qab ntawd ntsia mus rau hauv qab ntawm lub thawv hloov pauv, uas tseem muaj lub hau uas tuaj yeem npog nws.

Kuv tau ntxiv me ntsis ntawm Shoe Goo qhov twg cov xov hlau ntsib lub tsev tiv thaiv cov xov hlau. Thiab kuv tau lo rau "1" thiab "2" daim ntawv lo rau ntawm lub duav.

Kauj Ruam 6: Hom Kev Ua Haujlwm

Hom Kev Ua Haujlwm
Hom Kev Ua Haujlwm
Hom Kev Ua Haujlwm
Hom Kev Ua Haujlwm

Cov paddles muaj peb hom kev ua haujlwm. Koj tuaj yeem hloov pauv hom kev ua haujlwm los ntawm nias tshwj xeeb ua ke ntawm cov nyees khawm thaum ntsaws rau hauv USB chaw nres nkoj, tso tawm thaum lub rooj tsav xwm LEDs nres ntsais muag. Thaum koj hloov hom kev ua haujlwm, nws yuav raug khaws cia rau flash nco, thiab yuav nyob mus txog thaum koj hloov nws tom ntej. (Yog li, yog tias koj tsis xav hloov hom, tsis txhob nias lub pob thaum ntsaws cov paddles rau hauv USB chaw nres nkoj.) Nov yog cov kev xaiv:

  • Sab laug khawm duav nkaus xwb: Ib ob-axis ob-khawm joystick, nrog txhua lub axis thiab khawm tswj los ntawm ib tus duav. Ntxiv mus, cov paddles txheeb xyuas ua Stelladaptor, txiav txuas USB txuas rau Atari 2600 cov tswj hwm, thiab yog li Atari 2600 emulators zoo li Stella thiab Z26 uas yog Stelladapter sib xws yuav tsum ua haujlwm zoo kawg nkaus.
  • Ob lub duav khawm: Txhua tus duav qhia tau hais tias sib cais joystick. Joystick muaj ib lub khawm ua haujlwm, thiab tig lub duav txav lub joystick kab pheeb ces kaum, yog li X lossis Y axis ua haujlwm rau duav.
  • Txoj cai paddle khawm nkaus xwb: Cov paddles qhia tau tias yog ob-khawm nas kiag li. Tam sim no koj tuaj yeem siv qhov no zoo ib yam rau Etch-a-Sketch nrog cov duab kos.

Kauj ruam 7: Pong

Pong
Pong
Pong
Pong

Pong yog thawj qhov kev ua si duav zoo. Kuv pom zoo cov ntawv qub, vim tias clones feem ntau tsis suav nrog txhua qhov ntxim nyiam ua haujlwm zoo, zoo li kev hloov pauv nrawm nrog rov ua dua, lub kaum ntse ntse hloov pauv nyob ntawm ib feem ntawm tus duav uas ntaus pob, lossis maj mam tab sis tsis yooj yim kwv yees txoj haujlwm. ntawm qhov kev pabcuam tom qab tsis nco. Txog kev ua tib zoo tshuaj xyuas qhov qub, saib ntawm no.

Ib txoj hauv kev zoo tshaj los ua si Pong yog nrog DICE Circuit-emulator qib yog tias koj lub khoos phis tawj tau nrawm txaus siv nws nrawm. (Kuv lub khoos phis tawj Windows yog, tab sis Raspberry PI 3+ qeeb heev.) Kuv pom zoo version 0.8.

Yog tias koj siv Stelladaptor hom nyob rau hauv paddles, mus rau Chaw | Configure Inputs… hauv DICE thiab xaiv Joystick 1 thiab Absolute for Player 1 Paddle, thiab teeb tsa Kab Rov Tav thiab Ntsug rau Joy 1 X-Axis. Tom qab ntawd ua tib yam rau Player 2 Paddle, tshwj tsis yog nrog Y-Axis.

Yog tias koj lub khoos phis tawj qeeb dhau rau DICE, Kuv tau ua Python3+pygame version uas nws lub sijhawm thiab kev ua haujlwm tau txhais tau tias yuav nyob ze rau Pong thawj (Kuv zoo siab ua tsaug rau kev pab los ntawm Dr. Hugo Holden hauv qhov no).

Pom zoo: