Cov txheej txheem:

Kev Tswj Xyuas Taw Taw rau Tham Khawm: 5 Kauj Ruam
Kev Tswj Xyuas Taw Taw rau Tham Khawm: 5 Kauj Ruam

Video: Kev Tswj Xyuas Taw Taw rau Tham Khawm: 5 Kauj Ruam

Video: Kev Tswj Xyuas Taw Taw rau Tham Khawm: 5 Kauj Ruam
Video: Tshuaj theem vim li cas thiaj tau nqi ?/ Siv kho mob dab tsi?/paris polyphylla использовать для? 2024, Kaum ib hlis
Anonim

Nov yog qhov kuv tau ua Push To Talk khawm uas koj tuaj yeem siv nrog koj txhais taw.

Kauj Ruam 1: Sau Koj Cov Khoom thiab Cov Cuab Yeej

Sau Koj Cov Khoom thiab Cov Cuab Yeej
Sau Koj Cov Khoom thiab Cov Cuab Yeej
Sau koj cov ntaub ntawv thiab cov cuab yeej
Sau koj cov ntaub ntawv thiab cov cuab yeej

Thawj thiab qhov tseem ceeb tshaj plaws hauv ib qhov haujlwm yog sib sau koj cov ntaub ntawv thiab cov cuab yeej, tshwj tsis yog koj xav kom raug foom tsis zoo mus ncig mus nrhiav qhov cuab yeej uas koj xav tau txhua 2 feeb.

Khoom siv

  • Arduino Pro Micro - kev khob yuav ua haujlwm tsuav nws siv MEGA32U4 nti
  • RBG LED
  • Resistors

    • Liab - 180 Ω
    • Ntsuab - 100 Ω
    • Xiav - 100 Ω
  • Arcade Push Button
  • Hlau
  • Cov laug*
  • Shrink qhwv tubing - xaiv tau*
  • USB micro cable, ntev txaus los txog hauv pem teb*

Ib tsab ntawv ntawm kev xaiv Arduino. Tus Pro Micro siv MEGA32U4 nti uas ua haujlwm tau zoo nrog keyboard.h lub tsev qiv ntawv los ua cov cai yooj yim heev. Tus tswj hwm micro uas siv lub nti ntawd yuav tsum ua haujlwm (Kuv siv lub khob tawm thiab nws ua haujlwm zoo). Tsis tas li ntawm qhov version kuv tau ua kuv siv 330 Ω resistors rau txhua qhov, qhov no txhais tau tias liab liab ntau dua li lwm cov xim.

Cov cuab yeej

  • Soldering Hlau*
  • Hlau cutters*
  • Koob qhov ntswg pliers
  • Cov cuab yeej los ua rooj plaub

Ib daim ntawv ntawm rooj plaub: Kuv siv lub tshuab luam ntawv 3D los ua rooj plaub raws li kuv pom tias yog qhov yooj yim tshaj plaws. Koj tuaj yeem siv qhov xwm txheej uas koj xav tau rau qhov no, tab sis nco ntsoov nws yuav yog qee yam uas koj so koj txhais taw kom siv nws.

*Tsis pom hauv cov duab

Kauj Ruam 2: Tshooj Luam Ntawv - Xaiv tau

Kuv luam tawm 3 ntu thiab lawv yog qhov ntev tshaj plaws ntawm txoj haujlwm yog li ntawd yog vim li cas nws thiaj li pib ua haujlwm sai. Cov ntu tuaj yeem pom ntawm no.

Thawj qhov xav tau yog phau ntawv qhia soldering. Nws tau siv los tuav tag nrho cov ntu hauv txoj haujlwm thaum siv cov LED thiab Khawm ua ke.

Thaum luam tawm Sab saum toj ntawm rooj plaub Kuv siv kev txhawb nqa nyob rau sab saum toj ntawm lub pob qhib tab sis tsis muaj lwm qhov kev txhawb nqa xav tau.

Cov tom ntej yog nyob rau hauv ib qho kev txiav txim, rooj plaub sab saum toj thiab rooj plaub hauv qab. Hauv qab yuav ntxig rau sab saum toj kom kaw txhua yam.

Kauj Ruam 3: Sib Sau Koj Li Circuit Court

Sib sau ua ke koj Circuit
Sib sau ua ke koj Circuit

Cov kauj ruam no yog kom tau txais tag nrho cov ntu hauv Circuit Court ua ke. Kuv xav tias qhov no yog qhov tsis meej pem tshaj plaws.

RGB muaj 4 tus coj, ib qho rau txhua xim thiab ib qho rau hauv av. Nco tseg ntawm no tias kuv muaj ib qho cathode LED ib txwm, yog tias koj muaj ib qho anode LED koj tus pin teeb yuav txawv; txhawm rau nrhiav seb koj muaj dab tsi, saib lub pob, yog tias koj muaj, lossis sim thiab ntsaws rau hauv qhov hluav taws xob. Yog tias koj xav tau thov hauv av rau cov hmoov txhuas ntev tshaj plaws koj muaj cov cathode ntau, yog tias koj xav tau siv qhov hluav taws xob mus rau cov hlau lead ntev tshaj plaws thiab hauv av ib qho ntawm lwm txoj hauv kev koj muaj cov anode nquag. Kuv tsuas yog ua qhov no nrog cov cathode LED ib txwm muaj.

  1. Txhawm rau pib nrog hle qhov xaus ntawm 5 xov hlau, cov xov hlau kuv siv tau los ntawm lub tshuab computer qub hlua hlua.
  2. Kaw qhov kawg ntawm cov tshuaj tiv thaiv ncaj ncees, tej zaum txog 10 hli ntev lossis ntev txaus uas koj xav tias xis nyob ib yam nkaus.

    Yog tias koj siv cua sov ntsws, nws yuav npog qhov sib txuas ntawm cov xaim, tiv thaiv, thiab LED. Nws tsuas yog ua kom ntseeg tau tias tsis muaj cov xov hlau hloov pauv thiab luv luv

  3. Thaum koj muaj koj hom LED txiav txim siab solder cov LEDs rau qhov raug cai. Tsis txhob ham tus pin hauv av tsis tau.
  4. Nrog cov LED soldered mus rau lub resistors muab cov LED thiab khawm rau hauv cov ntawv qhia solder luam tawm hauv cov kauj ruam kawg. tam sim no khoov lub hauv paus LED hauv qab kom tau raws li ib qho ntawm cov khawm coj.
  5. Siv cov xaim av hauv av rau lub pob khawm thiab LED hauv av.
  6. Muab lub xaim hlau txuas rau lwm lub pob hlau lead.
  7. Siv lwm qhov kawg ntawm cov xov hlau mus rau tus pin raug ntawm Arduino.

Yog tias koj xav hloov LED pins nco ntsoov tias koj txuas lawv rau PWM tus pin ntawm Arduino. Ntawm Pro micro lawv yog tus pin nrog lub voj voos ncig lawv. Kev hloov kho tshiab kuj tseem yuav tsum tau ua rau cov cai.

Kauj ruam 4: Program Tus Tswj

Tam sim no nws yog lub sijhawm los ntsaws rau hauv Arduino thiab ntsaws qhov program.

Qhov kev zov me nyuam yog qhov yooj yim haum, nws yog ib qho kev hloov pauv ntawm Keyboard.h piv txwv thiab RGB LED piv txwv, tsuas yog qee yam sib tsoo thiab tsoo ua ke.

Tag nrho cov ntu saum toj no tau txheeb xyuas qee qhov txiaj ntsig uas yuav tsum tau siv los ntawm kev tshem tawm cov cai, ua ntej tus pin, cov nyees khawm thiab txhua lub xim LED tau txais tus pin, cov no tuaj yeem hloov kho yog tias koj xav tau.

Thawj ob peb kab tsuas yog txhais cov xim/xwm txheej. Lawv tuaj yeem hloov pauv tau yooj yim los ntawm kev nkag mus rau RGB tus nqi ntawm cov xim uas koj xav tau. Google muaj tus xaiv xim uas yuav muab rau koj qhov tseem ceeb ntawm cov xim.

Rau kev teeb tsa ua ntej peb teeb tsa peb hauv/tawm tus pin, hauv lub pob thiab tawm rau LEDs. Tom qab ntawd peb teeb cov xim ntawm LED rau ntawm cov xim teeb saum toj no. Thaum kawg peb yuav tsum pib kev sib txuas lus nrog lub khoos phis tawj, kom nws lees paub Arduino ua "keyboard" yog li peb tuaj yeem xa cov lus txib tseem ceeb.

Tom qab ntawd rau lub voj peb tsuas yog yuav tsum tau txheeb xyuas yog tias lub pob tau raug siv los siv digitalRead () ntawm tus pin khawm. Thaum peb pom cov xovxwm peb tuaj yeem xa qhov xav tau qhov mob stroke mus rau lub khoos phis tawj thiab hloov cov xim LED rau xim xim. Yog tias peb tsis pom tias lub pob tau raug nias peb tso cov keystroke teeb xim rov los rau ntawm cov xim.

Tsuas yog sau tseg ntawm no ntawm cov keyboard stroke peb tab tom xa, KEY_LEFT_ALT, thaum siv Keyboard.h lub tsev qiv ntawv peb xav siv xovxwm () thiab tso tawm () ntau dua li xa () rau cov hloov kho cov yuam sij, cov npe tag nrho tuaj yeem pom ntawm no. Rau txhua tus yuam sij koj siv xovxwm () ntawm koj kuj tseem yuav xav tau kev tso tawm () ntawm tus yuam sij ib yam nkaus li tus yuam sij ntawd yuav tuav cia kom txog thaum koj ntsaws Arduino.

#suav nrog

// txhais khawm tus pin thiab LED pins int Button_pin = 7; int RLED = 3; int GLED = 5; int BLED = 6; // txhais cov xim LED thaum lub xeev int Ron = 0; int Gon = 0; int Bon = 255; // txhais cov xim LED thaum xwm txheej lossis khawm nias lub xeev int RStat = 255; int GStat = 0; int BStat = 255; teeb tsa tsis muaj dab tsi () {// ua tus pin 10 qhov nkag mus thiab qhib rau // rub tawm resistor yog li nws mus siab tshwj tsis yog // txuas nrog hauv av: pinMode (Button_pin, INPUT_PULLUP); // teeb tsa LED pins pinMode (RLED, OUTPUT); tus pinMode (GLED, OUTPUT); pinMode (BLED, NTAWV); // teeb tsa LED rau ntawm cov xim sib piv Sau (RLED, Ron); analogWrite (GLED, Gon); analogWrite (BLED, Bon); Keyboard.begin (); } void loop () {// yog tias lub pob nyem yog (digitalRead (Button_pin) == LOW) {// xa xovxwm Keyboard.press (KEY_LEFT_ALT); // chagne lub LED xim rau cov xwm txheej xim analogWrite (RLED, RStat); analogWrite (GLED, GStat); analogWrite (BLED, BStat); } lwm tus {// tso qhov tseem ceeb Keyboard.release (KEY_LEFT_ALT); // hloov cov xim LED rau ntawm cov xim sib piv Sau (RLED, Ron); analogWrite (GLED, Gon); analogWrite (BLED, Bon); }}

Kauj Ruam 5: Muab tag nrho ua ke

Muab tso ua ke
Muab tso ua ke

Tam sim no uas peb tau ua rooj plaub, sib sau ua ke hauv Circuit Court, thiab tso cov cai ntawm peb Arduino peb thaum kawg tuaj yeem ua txhua yam ua ke.

Pub lub pob thiab LED tso rau hauv qhov chaw thiab teeb tsa Arduino rau hauv txoj haujlwm thiab koj yuav luag tiav!

Kauj ruam kawg uas yuav ua rau koj yuav yog mus rau hauv qhov program koj tab tom siv thiab teeb tsa lub pob koj tau ua haujlwm rau Arduino raws li kev thawb tham. Ntawm Discord desktop app qhov no ua tiav hauv Tus Neeg Siv Lub Suab & Video teeb tsa.

Qhov ntawd yog nws, koj yuav tsum tam sim no muaj kev ua haujlwm sab nraud los tham khawm!

Yog tias koj muaj lus nug txog qhov haujlwm no, thov tawm lawv hauv qab no thiab kuv yuav ua qhov zoo tshaj los teb!

Pom zoo: