Cov txheej txheem:

Custom Macro Mechanical Keypad: 12 Cov Kauj Ruam (nrog Duab)
Custom Macro Mechanical Keypad: 12 Cov Kauj Ruam (nrog Duab)

Video: Custom Macro Mechanical Keypad: 12 Cov Kauj Ruam (nrog Duab)

Video: Custom Macro Mechanical Keypad: 12 Cov Kauj Ruam (nrog Duab)
Video: 12 key 2 knob macropad Ali Express or Amazon Set up 2024, Kaum ib hlis
Anonim
Kev Cai Macro Mechanical Keypad
Kev Cai Macro Mechanical Keypad
Kev Cai Macro Mechanical Keypad
Kev Cai Macro Mechanical Keypad
Kev Cai Macro Mechanical Keypad
Kev Cai Macro Mechanical Keypad
Kev Cai Macro Mechanical Keypad
Kev Cai Macro Mechanical Keypad

Hauv Cov Lus Qhia Kuv yuav coj koj mus rau qhov pib ntawm kev tsim koj tus kheej 6 tus lej macropad, tswj los ntawm Arduino. Kuv yuav coj koj mus txog qhov koj xav tau, yuav ua li cas sib sau ua ke, yuav ua haujlwm li cas, thiab yuav txhim kho nws lossis ua nws li cas rau koj tus kheej.

Tom qab kev tshawb fawb ntau, Kuv tsis tuaj yeem nrhiav tau phau ntawv qhia zoo txog yuav ua li cas thiaj ua tau cov keyboard loj, lossis siv cov keyboard uas muaj tes siv dav. Yog li kuv txiav txim siab ua nws tus kheej, hauv txoj hauv kev yooj yim tshaj plaws, tsis muaj diodes, resistors, lossis lwm yam. Kuv kuj xav kom muaj cov keyboard sib txawv tshwj xeeb, qhov twg kuv tuaj yeem lob ib feem twg uas kuv xav tau, qhov no yog thawj ntawm ntau lwm qhov. Qhov kev tshoov siab ntawm tus qauv no yog los ntawm xub tuav ntawm cov keyboard, muaj peev xwm haum nws hauv koj lub hnab ris, thiab coj nws nyob txhua qhov chaw yog tias koj xav tau ob peb khawm ntxiv ntawm kev mus.

Vim li cas cov keypad no tau ua, Kuv pom zoo kom koj nyeem tag nrho Cov Lus Qhia ua ntej koj txiav txim siab yuav khoom.

Kuv kuj tau sim ua Cov Lus Qhia hauv cov lus txiav txim, tab sis kuv tsis tsim cov txheej txheem, yog li nws yuav zoo dua mus hla qhov kev txiav txim ntawm cov kauj ruam nyob ntawm seb koj tsim li cas.

Kauj Ruam 1: Tau Txais Cov Khoom

Tau Qhov Chaw
Tau Qhov Chaw

Cov kauj ruam ntev tshaj yog nyob ntawm no, yuav cov khoom thiab tos kom lawv xa nkoj. Amazon txuas yuav yog Canadian Amazon. Cov ntu uas koj yuav xav tau yog:

  1. Neeg kho tshuab yuam key

    • Kuv xaiv Gateron hloov pauv nrog lub ntsej muag ntshiab los ntawm no (Cov khaub ncaws saum toj ua rau cov kauj ruam tom ntej yooj yim dua, feem ntau hom kev hloov pauv tau them rau ib yam nkaus)
    • Lwm qhov chaw yuav khoom tuaj yeem nrhiav pom ntawm no hauv qab koj nyiam hloov ntu

      Kuv kuj tseem pom zoo ua qee qhov kev tshawb fawb ntawm no ntawm qhov kev hloov pauv koj xav tau ntawm no hauv ntu 'Xav'

  2. Mechanical Keycaps

    • Nco ntsoov tias lawv tau sib xws nrog koj qhov kev hloov pauv uas koj xaiv!

      Kuj xyuas kom tseeb tias lawv rov pom tau zoo dua yog li koj tuaj yeem hloov xim

    • Cov neeg muag khoom tuaj yeem nrhiav tau ntawm no hauv qab 'Qhov Tseem Ceeb Tshiab (txheej txheem tsim khoom)' ntu, tshwj tsis yog koj xav tau tag nrho Keycap teeb tsa
  3. Addressable RGB LED strips (Yeem tau, tab sis pom zoo heev)

    • Kuv yuav qee yam zoo sib xws los ntawm Amazon

      • Nco ntsoov tias LEDs yog WS2812B LEDs, lawv tuaj yeem lees txais qis dua.
      • Koj tseem tuaj yeem yuav 3mm li niaj zaus LEDs ntawm koj cov xim nyiam siv, tab sis koj xav tau cov neeg tiv taus
  4. HID sib xws micro tswj (Kuv siv Pro Micro)

    • Kuv yuav cov no los ntawm Amazon rau qhov zoo tshaj plaws

      Koj tuaj yeem yuav lwm tus tswj hwm micro, tab sis nco ntsoov tias lawv yog ob qho tib si Arduino thiab HID (tib neeg cov tswv yim ntaus ntawv) sib xws

  5. A 128x32 I2C OLED zaub

    Kuv yuav qhov no los ntawm Amazon

  6. Nkag mus rau lub tshuab luam ntawv 3D

    • Sim nrog cov tsev qiv ntawv hauv zos lossis tsev kawm ntawv nyob ib puag ncig koj thiab saib seb lawv puas muaj lub tshuab luam ntawv 3D
    • Kuv tus kheej tsis tau siv qhov kev pabcuam online, tabsis koj tuaj yeem siv cov ntawd ib yam (qee yam zoo li no)
  7. Nyias Hlau
  8. Cov Cuab Yeej Xav Tau

    • Soldering Iron thiab Solder
    • Sab Cutter Pliers
    • Cov Ntaub Ntawv Me Me (Me ntsis xaiv tau)
    • Kub Nplaum Rab Phom thiab Nplaum
    • Screwdriver thiab screws ntawm qhov koj xaiv

Kauj ruam 2: Keyswitch Hloov Kho

Keyswitch Hloov Kho
Keyswitch Hloov Kho
Keyswitch Hloov Kho
Keyswitch Hloov Kho
Keyswitch Hloov Kho
Keyswitch Hloov Kho

Pib tshem tawm cov hloov pauv uas koj tau yuav. Peb ua qhov no txhawm rau tso lub teeb ci dhau los kom zoo mus txog peb cov keycaps. Yog tias koj tau xaiv cov keycaps uas tsis txhawb nqa RGB, hla cov kauj ruam no.

Siv 2 daim me me (Kuv siv 2 lub taub hau ntswj taub hau me me) thiab thawb hauv qab cov tab ntawm sab ntawm qhov hloov. Tom qab ntawd muab ib yam dab tsi nyob nruab nrab ntawm sab saud thiab hauv qab kom nws tsis kaw. Ua mus thawb cov tab ntawm lwm sab, yog li tsis muaj cov tab yuav tsum tseem tuav saum toj. Tom qab ntawd, ua kom tiav thiab tawm sab saum toj ntawm qhov hloov. Muaj feem ntau yog plaub ntu, sab saum toj thiab hauv qab ntawm lub casing, lub caij nplooj ntoo hlav, thiab cov qia (zawv zawg ib feem ntawm qhov hloov pauv uas tuav tus yuam sij).

Pib txiav tej qhov me me tawm hauv qab ntawm rooj plaub kom tso cai ntau lub teeb kom dhau mus. Txiav lub tab uas tuav qhov hloov ntawm phaj ua ntej. Tom qab ntawd txiav me ntsis ntawm thawj LED hla dhau, (ib feem nrog 4 qhov, cov no yog rau ob txhais ceg ntawm LEDs). Maj mam txiav cov tab ntawd sab hauv kom nqes mus rau hauv qab. Tom qab ntawd txiav mus rau qhov nruab nrab cylindrical ntawm qhov hloov uas tuav lub caij nplooj ntoo hlav. Peb tsis tas yuav mus ntxiv dua qhov ntawd. Tom qab ntawd, nthuav lub qhov me ntsis, los ntawm kev txiav maj mam txiav ob sab nrog cov kev txhawb nqa ua ntej. Lwm cov kauj ruam xaiv tau yog sau nws, ua kom nws zoo dua, thiab tsis muaj jagged. Nco ntsoov tias muaj me me los tsis muaj cov khoom yas sab hauv ntawm lub casing los ntawm qhov no, vim koj tsis xav kom hloov pauv kom tau nyam. Nco ntsoov ua cov kev txiav no qeeb thiab me me, raws li kuv tau tawg ob peb kis los ntawm qhov dav ntawm ob sab txiav kom yuam cov ntaub ntawv sib nrug.

Yog tias ib nrab ntawm koj qhov kev hloov pauv tsis meej ib yam, sim hloov kho nws kom tso cai rau lub teeb ci los ntawm. Sim me ntsis los ntawm yam tsis ua txhaum qhov hloov pauv, vim tias koj tsis xav kom lub qia poob. Ib qho kev daws teeb meem tuaj yeem yog txiav tawm cov yas uas yuav tuav tau ib qho LED, thiab tso cov yas uas khaws cov qia nrog, thiab tsuas yog sau nws.

Kauj Ruam 3: 3d Luam Ntawv

3d Luam Ntawv
3d Luam Ntawv

Koj yuav tsum rub ib qho ntawm cov ntawv zip hauv qab no, thiab 3d luam tawm lawv. Yuav muaj ntau qhov sib txawv nyob ntawm qhov koj xav tau. Yuav muaj daim nplaub tshev nrog txhua cov ntaub ntawv ib txwm nyob hauv nws (KeybArrowSTLFiles), thiab ib qho nrog Autodesk tus tsim cov ntaub ntawv (KeybArrowSourceFiles), yog li koj tuaj yeem hloov kho cov ntaub ntawv thiab hloov lawv mus rau koj tus kheej xav tau. Cov ntaub ntawv sib txawv me ntsis ntawm qhov kuv luam tawm, qhov no yog vim muaj qee qhov tsim tsis raug, thiab kuv xav tias kuv tuaj yeem txhim kho lawv. Piv txwv yuav yog ob sab ntawm rooj plaub, kuv lub siab me ntsis yog li cov keycaps yuav tsis thawb txhua txoj hauv kev, cov ntaub ntawv tshiab yuav tsum kho qhov ntawd.

Kev tsim ntawm lawv yog qhov nyuaj heev, nrog ntau dua 30+ qib. Txhua yam kuv yuav hais yog tias yog koj xav tsim rooj plaub rau qhov sib txawv me me, koj yuav tsum ua kom ntseeg tau tias koj tau muaj kev paub dhau los nrog cov qauv 3d nyuaj. Nws tsis yog tiag rau cov neeg uas tshiab rau 3d tsim.

Nco ntsoov tias ob qho ntawm cov ntaub ntawv casing nyob ntawm 3 degree lub kaum ntse ntse, thiab koj yuav tsum tig lawv ncaj rau ntawm lub txaj

Kauj Ruam 4: Sib Sau Dab Tsi Koj Muaj Li No

Sib Sau Dab Tsi Koj Muaj Li No
Sib Sau Dab Tsi Koj Muaj Li No
Sib Sau Dab Tsi Koj Muaj Li No
Sib Sau Dab Tsi Koj Muaj Li No
Sib Sau Dab Tsi Koj Muaj Li No
Sib Sau Dab Tsi Koj Muaj Li No
Sib Sau Dab Tsi Koj Muaj Li No
Sib Sau Dab Tsi Koj Muaj Li No

Tam sim no peb muaj tag nrho peb cov khoom, thiab peb muaj cov ntawv luam tawm 3d, nws yog lub sijhawm los sib dhos nws me ntsis!

Muab tag nrho 6 qhov hloov pauv rau hauv phaj, thiab muab lo rau hauv qhov chaw. Peb yuav tsum tau lo lawv vim tias peb txiav cov tab uas tuav nws rau hauv qhov chaw. Kuv hais kom tos kom muab tso rau hauv OLED vim tias koj tsis xav kom nws slanted.

Tom ntej no, txiav 6 LEDs tawm thiab tso rau ntawm daim phaj LED. Cov duab plaub ntawm lub phaj yog los pab koj teeb tsa cov LEDs. Cov square LEDs yuav haum rau lawv, yog li koj tuaj yeem 3d luam tawm lwm qhov los pab ua kom haum, lossis tsuas yog kab nws los ntawm nraub qaum. Nco ntsoov tias cov xub taw qhia rau lwm LEDs, zoo li DO yuav raug muab muag rau DI. Siv cov xwm txheej no los lo rau ntawm LEDs nrog kua nplaum kub, thiab tuav lawv rau hauv qhov chaw thiab tos kom cov kua nplaum tuav.

Kuv siv daim ntawv pov thawj rau cov hloov pauv kom tuav cov LEDs (hauv cov duab) vim tias kuv tsis nyiam pov tseg cov kab xev, thiab txiav txim siab rov siv dua. Cov ntaub ntawv tshiab yuav tsis cuam tshuam dab tsi, tsuas yog ua kom yooj yim dua los ua ke.

Kauj Ruam 5: Teeb OLED

Teeb tsa OLED
Teeb tsa OLED
Teeb tsa OLED
Teeb tsa OLED
Teeb tsa OLED
Teeb tsa OLED

Kuv pom zoo siv Cov Lus Qhia no kom taug kev mus tas li. Lawv tau ua haujlwm zoo heev los piav qhia nws.

Koj yuav tsum rub tawm thiab ntshuam lub tsev qiv ntawv no thiab lub tsev qiv ntawv no kom cov cai ua haujlwm.

Thawj xaim nws. Hlau VCC rau VCC, thiab GND rau GND. Tom qab ntawd xaim SDA thiab SCL tus pin. SDA thiab SCL tus pin tuaj yeem sib txawv ntawm txhua Arduino, tab sis ntawm tus pro micro, SDA tau txuas mus rau tus pin 2, thiab SCL tau txuas mus rau tus pin 3. Saib tus pinout ntawm koj tus tswj hwm micro yog tias koj tsis paub meej txog dab tsi pins SDA thiab SCL tau txuas rau.

Tom ntej no yog kom nws tso saib thiab ua cov duab. Yuav muaj cov ntawv hauv qab no yuav ua li cas thiaj ua haujlwm tau. Thawj kauj ruam yog siv ScreenScan code (xub muab los ntawm Arduino ntawm no). Rub cov cai mus rau Pro Micro thiab qhib Serial nyeem ntawv (hauv qab cov cuab yeej tab saum toj). Nws yuav nyeem koj rov qab thiab chaw nyob ntawm OLED. Yog tias koj qhov chaw nyob yog 0x3C, ces koj tsis tas yuav hloov dab tsi. Yog tias nws tsis yog, koj yuav tsum mus thiab hloov chaw nyob hauv ssd1306_128x32_i2c code thiab tus lej kawg (npe ArrowKeypad) kom nws ua haujlwm tau zoo.

Tam sim no sim tawm cov piv txwv uas suav nrog Adafruit ssd1306 lub tsev qiv ntawv uas rau 128x32 i2c code (npe ssd1306_128x32_i2c)

Tom qab ntawd, khaws Arduino rau, thiab sim ua kab ntawm OLED ntawm lub phaj hloov, tom qab ntawd tua nws thiab sim muab lo rau nws. Koj yuav feem ntau yuav tsis tau txais qhov kev sim ua ntej no, tab sis tseem hloov kho kom ua kom sib haum, yog li nws tsis yog kaum thaum nws ua tiav. Kuv hais kom gluing ib sab me ntsis, thiab tshuaj xyuas ua ntej koj muab lo rau lwm sab kom paub tseeb tias nws tsis slanted.

Rub tawm txoj cai tam sim no, thiab siv lwm cov ntaub ntawv ntawm tus lej hauv Kauj Ruam 8 tom qab hauv Cov Lus Qhia no

Kauj ruam 6: Soldering

Soldering
Soldering

Cov ntaub ntawv Fritzing yuav muaj nyob hauv qab no. Qhov no yuav tso cai rau koj los cuam tshuam nrog kev siv hluav taws xob thiab yog tias koj tso sab laug thiab tuav, koj tuaj yeem pom cov xov hlau txuas nrog txhua yam (hais txog qhov xim daj) cov ntaub ntawv uas yuav tsum tau xa mus rau Fritzing ua ntej koj qhib cov ntawv yuav nyob hauv qab no (rau Pro Micro thiab LEDs).

Nco ntsoov tias cov pins labled "MOSI, MISO lossis SCLK" tsis siv lossis nws yuav ua rau muaj teeb meem nrog OLED

Tom qab txiav 6 LEDs rau hauv ib daim hlab, thiab muab lo rau hauv phaj. Muab cov hlau txuas rau ntawm cov ntaub qhwv tooj liab, thiab ntxiv cov tshuaj txhuam rau txhua daim ntaub qhwv. Txiav cov hlau me me thiab hle ib nrab ntawm nws, ntswj nws, tom qab ntawd tshem tawm ib nrab thiab ntswj cov xaim. Cov xaim yuav xav tau tuav nrog cov cuab yeej lossis qee qhov siv tes pab, thaum koj tau tuav nws los ntawm tus neeg siv tshuaj. Ntxiv cov laug kom tuav nws nyob ntawd zoo. Luag tag nrho cov LEDs hauv kab ua ke. Txiav ib lub xov hlau, thiab txuas nws mus rau qhov kawg ntawm LED ntawm thawj kab, nrog daim ntawv lo 'DO' lossis 'D-', thiab txuas nws mus rau thawj LED ntawm kab thib ob nrog daim ntawv lo 'DI' lossis 'D+ '. Koj tuaj yeem ua qhov no nrog 5v thiab GND ib yam nkaus, tab sis nws yooj yim dua yog tias thawj LEDs 5v thiab GND ntawm txhua kab tau txuas ua ke. Hlau 5v xaim mus rau VCC, Cov ntaub ntawv tus pin rau ib tus lej digital (tus lej nws tau teeb tsa ua 10) thiab GND rau GND ntawm Arduino.

Txhawm rau kom Arduino lees paub cov tswv yim, cov hloov pauv yuav tsum txuas hauv av rau tus lej pin. Yog li, koj tuaj yeem txuas ib lub xaim txuas mus rau txhua 6 qhov hloov pauv mus rau hauv av. Siv ib lub xaim rau txhua qhov hloov pauv, thiab yog tias ua tau, sim hloov xim ntawm cov xov hlau kom taug qab qhov hloov pauv yog xaim dab tsi. Pub cov xov hlau los ntawm cov phaj LED thiab xaim lawv mus rau cov ntaub ntawv tus pin ntawm Arduino (Kuv siv cov ntaub ntawv pins 5-9 rau qhov no)

Ob qhov hloov pauv ntawm sab muaj cov haujlwm sib txawv, ib qho yog rov pib dua rau lub khoos phis tawj, thaum lwm qhov yog lub luag haujlwm hloov pauv, uas yuav hloov ntawm cov khaubncaws sab nraud povtseg ntawm Keypad kom hloov pauv cov haujlwm tau sai. Qhov hloov pauv sab saum toj, yog xaim rov pib dua (RST) thiab GND, thaum txuas nrog, nws ua rau rov pib dua. Qhov hloov hauv qab yog txuas mus rau tus pin 18, uas tau sau tias yog A0 ntawm Pro Micro. Ua rau koj tus kheej qee qhov qis nrog cov xov hluav taws xob hloov pauv, zoo li koj tseem xav tau xaub hauv cov phaj, thiab tsawg dhau ntawm cov xaim yuav tsis tso cai rau daim hlau los ntxig rau saum.

Kauj Ruam 7: Taw qhia rau Txoj Haujlwm

Taw qhia rau Programming
Taw qhia rau Programming

Ua ntej koj xav kaw rooj plaub, koj xav sim nws thiab xyuas kom nws ua haujlwm. Koj tuaj yeem hla mus rau qib 11 txhawm rau sib sau nws tam sim no. Kuv tsuas yog pom tias kev sim nws ua ntej yuav pab txo lub sijhawm koj qhib thiab kaw nws. Txawm hais tias nws yuav tsum tsis cuam tshuam rau nws ntau, Kuv tau siv Arduino IDE version 1.8.3, yog li yog tias koj muaj teeb meem, sim siv cov ntawv no. Cov cai nyob ntawm Kauj Ruam 5, nws yog cov ntawv zip uas koj yuav tsum tau muab rho tawm thiab xa los ntawm Arduino.

Yuav muaj ntau daim lej hauv qab no. Ib qho yuav yog tus lej kawg, ob qho yuav los ntsuas OLED (Ib qho los sim, ib qho kom pom qhov chaw nyob), thiab ib qho yuav los ntsuas RGB. Siv tus lej kawg los ntsuas qhov hloov pauv.

Yog tias koj xav tsim koj tus lej, kuv tab tom qhia ntawd hauv 3 kauj ruam tom ntej, tab sis nws zoo tag nrho yog tias koj xav siv kuv tus lej, lossis coj nws thiab hloov kho nws.

Qee qhov tseem ceeb ntawm lub cajmeem no

  • Hauv qab "Cov cuab yeej" tab, tom qab ntawv "Pawg", teeb nws rau Arduino Leonardo (Tshwj tsis yog tias koj muaj lub micro tswj uas txawv ntawm Pro Micro)
  • Siv qhov hloov pauv hloov tshiab txhua zaus koj tso cov lej rau Pro Micro. Kuv tau pom tias ib zaug ua ke bar puv, thiab tseem tab tom rub tawm, nws yog lub sijhawm zoo los nyem qhov hloov pauv thiab tawm mus rau txoj haujlwm. (Yog tias koj tsis ua qhov no, qhov upload yuav tsuas yog ua tsis tiav.)
  • Txhua lub tsev qiv ntawv siv yuav tsum tau teeb tsa thiab ntshuam

    Txhawm rau import, mus rau cov cuab yeej tab thiab nyem suav nrog lub tsev qiv ntawv. (Nco tseg tseem, kuv tus lej piv txwv ntawm lub vev xaib yuav tsum muaj nyob ib puag ncig lub tsev qiv ntawv lub npe, Kuv tsis tuaj yeem nkag mus rau lawv hauv ntu piv txwv ntu ntawm ob peb kauj ruam tom ntej)

  • Cov tsev qiv ntawv LED thiab OLED yuav pib ua cov khoom, koj tuaj yeem tso npe rau lawv yam twg los xij, tab sis rau qhov ua kom pom tseeb kuv yuav sau lawv 'strip' thiab 'display'

    Hu lub luag haujlwm los ntawm ib yam khoom los ntawm kev ntaus lub npe lub npe, muab lub sijhawm, tom qab ntawd ntaus lub luag haujlwm uas koj xav siv

Tom ntej ntsuas LEDs, xa cov cai, thiab paub tseeb tias lawv txhua tus ua haujlwm. Yog tias tsis ua haujlwm, koj ploj tus pin mus rau lawv, txheeb xyuas koj qhov muag ntawm thawj LED.

Thaum kawg, siv tus lej kawg los ntsuas koj cov keyboards. Qhov no yuav tsum yog qhov yooj yim ua. Nco tseg tias tam sim no, tom qab tso qee qhov HID code, koj yuav tsum tau rov pib dua Arduino txhua lub sijhawm uas koj xa cov cai rau nws. Tsuas yog rov pib dua ib nrab ntawm kev rub nws thiab nws yuav tsum ua haujlwm.

Kauj Ruam 8: Programming Cov Hloov

Programming Hloov
Programming Hloov
Programming Hloov
Programming Hloov

Tawm ntawm txhua qhov kev ua haujlwm, cov hloov pauv yog qhov nyuaj tshaj plaws. Txhawm rau kom nws lees paub tias yog cov keyboard, txhua yam koj xav tau siv yog Arduino Keyboard lub tsev qiv ntawv, thiab cov lus hais raws li txoj cai. Nco ntsoov tias hauv qab Cov Cuab Yeej tab, Pawg Thawj Coj tau teeb tsa rau Arduino Leonardo yog tias koj siv Pro Micro zoo li kuv.

Ua ntej peb pib nrog cov lus hais raws cai, peb yuav tsum teeb tsa tus pin. Peb tsuas xav tau qhov no los ua ib zaug, yog li muab qhov no tso rau hauv qhov tsis muaj teeb tsa. Pib nrog pinMode (PinNum, INPUT_PULLUP); Qhov no qhia rau Arduino tias PinNum tab tom xav tau cov lus tawm tswv yim, thiab nws ntxiv qhov rub tawm qhov tawm tsam (yog li peb tsis tas yuav xaim ib qho hauv cov khoom kho vajtse)

Cov tswv yim rub tawm muaj 2 lub xeev, LOW thiab HIGH. Arduino yuav nyeem LOW ntawm tus pin thaum nws txuas nrog hauv av (GND) thiab yuav nyeem HIGH thaum nws raug txuas. Txhawm rau pom dab tsi tus lej nyeem ntawv, peb siv digitalRead (PinNum).

Pib nrog cov hauv paus, peb siv raws li txoj cai yog cov nqe lus los nrhiav seb tus yuam sij raug nias. Peb xav kom qhov no dhau mus thiab dhau mus yog li peb xav kom qhov no muab lub voj void. Yog tus yuam sij tau sau npe ua "LOW" ces peb xav kom tus yuam sij raug nias, thiab tus yuam sij yuav raug tso tawm thaum lub tswv yim "HIGH". Yog li txhawm rau ua qhov no, peb code yog (digitalRead (PinNum) == LOW) {[Code rau thaum lub khawm raug nias]} thiab code yog (digitalRead (PinNum) == HIGH) {[Code rau thaum lub pob raug tso tawm] }

Txog tus lej rau cov keyboard, ntshuam Keyboard lub tsev qiv ntawv. Muab cov keyboard.begin (); hauv qhov tsis muaj teeb tsa. Tom qab ntawv sab hauv ntawm peb cov lus hais raws cai, peb siv keyboard.press ([key]); thiab keyboard.release ([qhov tseem ceeb]); lossis keyboard.releaseAll (); yog tias koj muaj ntau tus yuam sij nias. Koj kuj tseem tuaj yeem siv keyboard.print ([Txoj hlua]); thiab keyboard.println ([String]) los luam cov hlua, zoo li tus password. luam tawm thiab luam tawm zoo ib yam, tab sis println tsuas yog ntxiv ENTER, yog li nws cia li mus rau kab tom ntej.

Kauj ruam 9: Programming OLED

Programming OLED
Programming OLED
Programming OLED
Programming OLED
Programming OLED
Programming OLED

Pib nrog kev tsim cov txheej txheem OLED, koj yuav tsum muaj tus lej teeb tsa yooj yim. Qhov no pib qhia lub khoos phis tawj qhov twg koj OLED nyob, qhov loj ntawm nws, thiab nws tau npaj li cas. Thaum koj muaj tus txheej txheem teeb tsa rau OLED, piv txwv tias koj tsuas yog tso tawm cov ntawv, nws yuav tsum yooj yim zoo nkauj rau program. Ua ntej suav nrog Cov Ntawv thiab Cov Ntaub Ntawv SSD1306.

Txhais OLED_RESET li 4, thiab suav nrog SSD1306 lub tsev qiv ntawv hauv koj tus lej. Muab Adafruit_SSD1306 zaub (OLED_RESET); hauv koj tus lej txhawm rau pib siv Adafruit SSD1306 lub tsev qiv ntawv.

Pib nrog Serial.begin (9600); ces display.begin (SSD1306_SWITCHCAPVCC, 0x3C); los pib lub i2C zaub nrog qhov chaw nyob ntawm 0x3C (tshwj tsis yog nws hloov pauv hauv qib 5). Muab ob qho no tso rau hauv qhov tsis muaj teeb meem vim tias lawv tsuas xav tau khiav ib zaug.

Ua ntej koj teeb tsa lub vijtsam, koj yuav tsum paub tseeb tias koj siv display.clearDisplay. Yog tias koj tsis ua dab tsi uas tau nkag los yuav sib tshooj, thiab nyob ntawm qhov hloov pauv, yuav tsis raug nyeem. Koj kuj xav teeb tsa lub hauv paus chiv keeb, yog li siv display.setCursor (0, 0); los teeb nws ntawm tus taw tes ntawm koj cov zaub, tso (0, 0) rov pib dua nws rov mus rau qhov pib. Txhawm rau teeb tsa qhov loj ntawm cov ntawv, siv display.setTextSize (1); Kuv yuav tsis mus loj dua 1, nws loj dua qhov xav tau.

Txawm hais tias peb cov duab yog monochrome, peb yuav tsum teeb cov ntawv xim, yog li peb tsim nws zoo li display.setTextColor (WHITE);

Tam sim no koj muaj koj lub tsev qiv ntawv nkag thiab koj cov khoom pom, koj tuaj yeem pib ua haujlwm rau nws. Txhawm rau ntxiv cov ntawv, siv display.print (); thiab display.println (); luam cov hlua. Ib zaug ntxiv, luam ntawv tsis ntxiv qhov xa rov qab thaum println cia li rov qab mus rau kab tom ntej thaum qee yam luam tawm dua.

Ua ntej koj yuav tau txais ib yam dab tsi los tso saib, koj yuav tsum hloov kho OLED, thiab qhia nws hloov tshiab, koj siv display.display (); nrog tsis muaj qhov ntsuas thiab nws yuav hloov tshiab.

Txoj cai yuav tsum zoo ib yam li no tam sim no:

// Code Ua los ntawm Foster Phillips

#include Adafruit_SSD1306.h #include Wire.h #define OLED_RESET 4 Adafruit_SSD1306 zaub (OLED_RESET); teeb tsa tsis muaj dab tsi () {pinMode (SWITCH, INPUT_PULLUP); Serial.begin (9600); display.begin (SSD1306_SWITCHCAPVCC, 0x3C); display.display (); ncua (2000); display.clearDisplay (); display.setTextSize (1); display.setTextColor (WHITE); } void loop () {display.display (); ncua (2000); display.clearDisplay (); display.setTextSize (1); display.setCursor (0, 0); display.println ("Nyob Zoo Ntiaj Teb!"); display.println ("Nyob Zoo Cov Lus Qhia!"); }

Cov lus qhia no thiab Github txuas no yog ob qho tib si zoo heev rau kev daws teeb meem, thiab kawm paub ntau ntxiv txog kev ua haujlwm ntawm cov khoom tso saib.

Kauj Ruam 10: Kev teeb tsa cov LEDs

Programming cov LEDs
Programming cov LEDs
Programming cov LEDs
Programming cov LEDs
Programming cov LEDs
Programming cov LEDs

Cov LEDs yog qhov yooj yim tsim nyog ib yam nkaus. Peb yuav siv Adafruit Neopixel lub tsev qiv ntawv. Tus kheej, lub tsev qiv ntawv NeoPixel zoo ib yam rau kev ua haujlwm hauv Kev Ua Haujlwm, yog tias koj tau ua haujlwm nyob rau ntawd.

Muaj thawj qhov teeb tsa teeb tsa, hais txog lub tsev qiv ntawv twg peb tab tom siv, thiab teeb tsa kab lus uas hais tias muaj pes tsawg LEDs nyob ntawm tus pin, tus pin yog rau cov ntaub ntawv, thiab nws tau npaj li cas. Qhov no ua tiav nrog qhov piv txwv zoo li Adafruit_NeoPixel strip = Adafruit_NeoPixel (6, 10, NEO_GRB + NEO_KHZ800); Qhov no piav qhia tias muaj 6 LEDs, tus lej yog tus lej tus lej 10, thiab qhov ntawd yog siv NEO_GRB + NEO_KZH800 hom ntawm cov kab lus hais tau. Feem ntau qhov kev sib cav zaum kawg tsis tas yuav kov, cov hlua LED uas kuv siv tsis xav tau qhov hloov pauv.

Tom qab ntawd koj xav tau strip.begin (); muaj nuj nqi qhia tias koj tau npaj pib siv lawv. Tsis muaj dab tsi xav tau nyob hauv cov kab zauv.

Thaum koj muaj qhov ntawd, koj tuaj yeem hu cov haujlwm sib txawv nrog cov hlua. [Ua haujlwm]

Ib qho uas koj yuav tsum paub yog strip.setPixelColour. Qhov no muaj 4 lub luag haujlwm hauv cov kab ke. Koj muaj LED nyob hauv 'array' ntawm LEDs (nco ntsoov, Arrays pib ntawm 0) thiab qhov sib xws liab, Ntsuab, thiab Xiav qhov tseem ceeb ntawm 0-255. Qhov no yuav tso cai rau koj los sib xyaw qhov xav tau Liab Ntsuab thiab Xiav kom tau txais xim uas koj xav tau. Cov cai yuav tsum zoo li: strip.setPixelColour (0, 0, 255, 255); yog tias koj xav tau xim ntsuab ntawm thawj LED.

LED tseem yuav tsum tau xa cov ntaub ntawv ntawd, uas yog dab tsi strip.show (); ua. Nws yuav hloov kho cov pixels tom qab koj tau hloov qee yam nrog lawv. Tsis muaj dab tsi xav tau mus rau hauv cov kab zauv.

Cov cai yuav tsum zoo li:

// Code Ua los ntawm Foster Phillips

#include Adafruit_NeoPixel.h #define PIN 10 #define Num 6 Adafruit_NeoPixel strip = Adafruit_NeoPixel (Num, PIN, NEO_GRB + NEO_KHZ800); teeb tsa tsis muaj dabtsis () {strip.begin (); strip.show (); } void loop () {strip.setPixelColor (0, 255, 0, 0); strip.setPixelColor (1, 255, 0, 0); strip.setPixelColor (2, 255, 0, 0); strip.setPixelColor (4, 255, 0, 0); strip.setPixelColor (3, 0, 0, 255); strip.setPixelColor (5, 0, 0, 255); strip.show (); }

Cov ntaub ntawv ntxiv tuaj yeem pom ntawm no.

Kauj ruam 11: Sib sau ua ke

Sib dhos!
Sib dhos!
Sib dhos!
Sib dhos!
Sib dhos!
Sib dhos!

Qhov no tej zaum yog cov kauj ruam yooj yim tshaj plaws, thiab txias tshaj plaws.

Pib los ntawm kev tso thiab swb hauv Pro Micro mus rau rooj plaub kaw. Muab nws tso rau hauv qhov chaw nrog qee cov kua nplaum kub.

Cov ntaub ntawv/kaw tau tsim los kom koj tuaj yeem sab ntawm lub phaj hloov pauv thiab LED phaj hauv. Tsuas yog xaub nws, thiab nyob ntawm seb koj luam nws li cas, koj yuav xav tau ntawv lossis txiav sab hauv ntawm cov swb kom tshem qee cov yas yas.

Tom qab ntawd, tau txais koj cov ntsia hlau thiab tsuas yog jam nws rau hauv thiab ua koj tus kheej lub qhov ntsia hlau. Kuv tsis muaj cov xov tshwj xeeb tshwj xeeb thaum kuv tsim cov ntawv, yog li kuv tsuas yog ua lub qhov ntxhib me me ntawm cov ntsia hlau thiab ntsia nws hauv kuv tus kheej. Cua sov nws nrog lub teeb yuav pab tsim nws rau cov ntsia hlau uas koj xav tau, thiab feem ntau ntxiv dag zog rau txheej. Nco ntsoov tsis thawb ntau dhau ntawm cov ntsia hlau, lossis koj tuaj yeem hle lub taub hau. Kuv siv Allen qhov tseem ceeb screws los txo qhov kev pheej hmoo no.

Tom qab ntawd cia li thawb lub khawm tseem ceeb rau cov yuam sij. Tom qab ntawd nws zoo nkauj npaum li cas! Kuv qhov version ntawm Arrow Key Macropad tau ua tiav!

Kauj Ruam 12: Koj Tus Kheej Kev Txhim Kho

Tam sim no koj paub yuav ua li cas rau kuv version, koj tuaj yeem ua koj tus kheej! Keyboards tuaj yeem sib cav txog kev qhia koj tus kheej, yog li tsuas yog muaj lwm tus tsim qhov tsis lom zem tshwj tsis yog koj hloov kho kom haum koj! Muaj ntau qhov kev txhim kho koj tuaj yeem ua tau! Nov yog qee qhov kev txhim kho uas kuv xav ntxiv lossis xav txog!

  • Program Tetris thiab lwm yam kev ua si yooj yim
  • Ua nws bluetooth
  • Tso cai rau nws nyeem cov ntaub ntawv los ntawm cov duab swb thiab tso nws ib qho OLED (Qhia tus lej swb thiab lub npe ntawm swb)
  • Ua kom tag nrho cov keyboard lossis macropad loj dua siv cov txheej txheem no

    Koj yuav tsum tau kawm paub yuav ua li cas hloov matrix rau qhov no

  • Kev xaiv xim ntau dua
  • Program macros rau kev ua si, kho video, thiab lwm yam.
  • Siv Autodesk Inventor cov ntaub ntawv los ua koj li ntaub ntawv, lossis hloov kho nws kom tsis yog koj li!
  • Ntxiv lub suab lus kom muaj nws ob npaug ua lub suab paj nruag

Muaj kev lom zem ua! Xav tias dawb los ntxiv cov lus qhia lossis nug kuv kom meej!

Yog tias koj xav pom kev nce qib ntawm lwm qhov, txiav txim siab txheeb xyuas kuv li Instagram. Ua tsaug rau kev nyeem kuv Cov Lus Qhia!

Kev sib tw Microcontroller
Kev sib tw Microcontroller
Kev sib tw Microcontroller
Kev sib tw Microcontroller

Khiav Tawm Hauv Kev Sib Tw Microcontroller

Pom zoo: