Cov txheej txheem:

Handheld Shortcut Controller (rau Photoshop + Ntau) [Arduino]: 4 Cov Kauj Ruam
Handheld Shortcut Controller (rau Photoshop + Ntau) [Arduino]: 4 Cov Kauj Ruam

Video: Handheld Shortcut Controller (rau Photoshop + Ntau) [Arduino]: 4 Cov Kauj Ruam

Video: Handheld Shortcut Controller (rau Photoshop + Ntau) [Arduino]: 4 Cov Kauj Ruam
Video: Use a Joy-Con for Photoshop Shortcuts 2024, Hlis ntuj nqeg
Anonim
Handheld Shortcut Controller (rau Photoshop + Ntau) [Arduino]
Handheld Shortcut Controller (rau Photoshop + Ntau) [Arduino]

Lub sijhawm kawg kuv tau tsim lub ncoo me me los siv hauv Photoshop. Nws ua haujlwm xav tsis thoob, thiab kuv tseem siv nws! Tab sis nws tseem yog qhov txwv, nrog tsuas yog tsib lub nyees khawm thiab qhov muaj txiaj ntsig loj thiab tsis pom kev hu. Kuv tseem pom kuv tus kheej ncav tes rau cov keyboard ntau heev …

Yog li kuv tau pib ua haujlwm ntawm qhov rov ua dua ntawm kev tswj lub ncoo, ib qho nrog txoj hauv kev ntau khawm thiab ua haujlwm. Ib lub ncoo tswj hwm lawv txhua tus.

Qhov no tsis yog lub ncoo tswj. TAB SIS nws yuav zoo dua.

Yuav ua li cas yog tias koj tuaj yeem muaj ib tuj ntawm qhov luv, tab sis nyob rau hauv qhov zoo tshaj plaws thiab pob ntim koj tuaj yeem tuav nrog koj txhais tes dawb thaum koj kos tsis cuam tshuam? … ok, txaus nrog infomercial.

Tus tswj hwm no tau teeb tsa txoj hauv kev uas, nrog tsuas yog 4 khawm, nws tuaj yeem teeb tsa mus txog 32 qhov ua tau luv luv! Lub khawm thib 5 ntxiv nyob ntawd tso cai rau kuv siv cov hloov kho cov yuam sij hauv ib qho ua ke, uas muaj txiaj ntsig zoo rau ntau cov haujlwm (koj puas tau sim Alt-RMB combo hauv PS? Yog tias koj tsis tau, thov ua. Nws yog lub neej cawm siav). Kuv piav qhia qhov system tom qab.

Txhawm rau ua txhua yam no koj yuav xav tau:

  • 1 Microcontroller (Kuv siv Adafruit ItsyBitsy 32u4 tab sis ib qho yuav tsum ua ntev li nws muaj lub atmega32u4 nti)
  • 1 micro-USB adapter (cov ntaub ntawv, tsis yog lub zog nkaus xwb)
  • 5 cov nyees khawm (Kuv siv cov mos muag, zoo li cov no)
  • 10k Ohm resistors (1 rau khawm)
  • Cov xov hlau, cov ntawv ci, cov khoom siv sib txuas, thiab lwm yam.
  • Ib yam dab tsi los ua lub casing nrog (3D tshuab luam ntawv, thiab lwm yam)

Nov yog qhov haujlwm nruab nrab theem Arduino, thiab kuv hais qhia saib kuv qhov kev qhia yav dhau los kom nkag siab zoo tias muaj dab tsi tshwm sim, ntau qhov no yog rov ua dua ntawm cov uas kuv tau piav qhia rau ntawd.

Ok, cia peb pib!

Kauj ruam 1: Npaj

Kev npaj
Kev npaj

Qhov no yog qhov yooj yim schematic kuv kos ntawm tus tswj. Lub Circuit Court yog qhov yooj yim heev thaum koj piv nws rau kuv qhov haujlwm yav dhau los! Tab sis peb yuav tuaj yeem ua tau ntau ntxiv nrog ob peb lub khawm nws muaj, nrog lub zog ntawm kev sib zog nias!

Lub tswv yim tom qab cov phiaj xwm tswj hwm yog tias txhua lub pob tuaj yeem yog pub dawb, nias thiab tso tawm, lossis nias thiab tuav. Nias thiab tso tawm yog dab tsi uas yuav ua rau qhib txoj kev luv luv, thaum tuav cov nyees khawm yuav ua rau peb nkag mus rau qhov sib txawv luv luv. Yog li yog tias koj tsuas yog nias lub pob A, koj yuav qhib txoj haujlwm luv A, tab sis yog tias koj tuav B thaum nias A, koj yuav tau txais qhov sib txawv luv. Koj tuaj yeem tuav txog 3 lub nyees khawm ib zaug thaum nias, yog li thaum koj siv qee qhov kev sib xyaw ua ke yooj yim, koj yuav pom tias muaj pes tsawg qhov kev sib txuas ua ke tau nrog cov kab ke no!

Lub khawm thib tsib ntxiv zoo li lub ntuj ntxiv, muab lub ntsej muag zoo li kuv tuaj nrog. Kuv txiav txim siab siv nws txhawm rau nkag mus hloov tus yuam sij hauv photoshop. Txoj hauv kev nws ua haujlwm sib txawv me ntsis los ntawm lwm cov nyees khawm: thaum twg khawm tus ntiv tes xoo tuav, tsuas yog siv tus hloov pauv. Cov no yuav qhib thaum lawv tuav thiab ntau yam tuaj yeem nias. Yog li yog tias khawm A yog Shift, thiab khawm B yog Ctrl, thaum koj tuav A thiab B nws yuav zoo li nias ob qho ua haujlwm thiab Ctrl, tab sis tsuas yog ntev li ntev li tus ntiv tes xoo tuav!

Lub plhaub tau tsim los ua ob qho tib si ergonomic thiab ambidextrous. Kuv tau saib xyuas zoo kom ua kom haum haum kom siv tus ntiv tes me tsis yog nkees heev, thiab nws yuav tsum ua haujlwm rau cov uas muaj tes loj dua kuv ib yam.

Kauj ruam 2: Tsab Cai + Code

Prototype + Code
Prototype + Code

Nws yog qhov kev xyaum zoo los ntsuas cov nyees khawm ntawm lub khob cij. Nws yog qhov yooj yim zoo nkauj, tsuas yog txuas cov nyees khawm thiab cov resistors raws li qhia. Koj tuaj yeem sim nws nrog cov cai ntawm no (pastebin txuas lwm txoj hauv kev):

#suav nrog

// siv vthisv xaiv rau MacOS:

// char ctrlKey = KEY_LEFT_GUI;

// siv vthisv xaiv rau Windows thiab Linux:

char ctrlKey = KEY_LEFT_CTRL; char shiftKey = KEY_LEFT_SHIFT; char altKey = KEY_LEFT_ALT;

// Cov haujlwm tseem ceeb ntawm no

char Fn1Key = KEY_F2; char Fn2Key = KEY_F3; char Fn3Key = KEY_F4; char Fn4Key = KEY_F5;

const int pins = {9, 10, 11, 12, 13}; // array ntawm txhua tus khawm pins

// Kev nkag siab

const int THRESH_0 = 10; const int THRESH_1 = 20; const int THRESH_2 = 25; const int THRESH_3 = 50; const int THRESH_4 = 100; const int THRESH_5 = 200;

const int BUTTON_NUM = 5;

// Khov khov

const int DELAY = 0;

enum States {tso tawm, nias, tuav, tso tawm};

khawm khawm {

tus pin; Xeev lub xeev; int timeHeld; }; // ntiv tes xoo, ntsuas, nruab nrab, ntiv nplhaib, me ntsis;

khawm khawm [BUTTON_NUM] = {};

khawm initButton (int p) {

khawm b; pinMode (p, INPUT); b.pin = np. b.state = Xeev:: tso tawm; b.timeHeld = 0; rov b; }

void teeb tsa () {

// muab koj cov cai teeb tsa ntawm no, kom khiav ib zaug: Serial.begin (9600); Keyboard.begin ();

thaum (! Serial) {};

// Nyees khawm rau (int i = 0; i <(BUTTON_NUM); ++ i) {Serial.print ("set button"); Serial.print (kuv); Serial.print ("ntawm tus pin:"); Serial.println (pins [kuv]); //buttons.pin = 1; nyees khawm = initButton (pins ); Serial.println (cov nyees khawm .pin); }

}

bool readButton (tus pin) {

// txheeb xyuas thiab nthuav tawm cov nyees khawm yog (digitalRead (tus pin) == HIGH) {ncua sijhawm (10); yog (digitalRead (tus pin) == HIGH) {rov muaj tseeb; }} rov tsis tseeb; }

int pintobin (tus pin) {

yog (tus pin == pins [0]) rov qab 1; yog (tus pin == pins [1]) rov qab 10; yog (tus pin == pins [2]) rov qab 100; yog (tus pin == pins [3]) rov qab 1000; yog (tus pin == pins [4]) rov 10000; } khawm buttonStateUpdate (khawm b) {

bool nias = readButton (b.pin);

hloov (b.state) {case States:: freed: b.timeHeld = 0; yog (nias) b.state = States:: nias; tawg; rooj plaub nias: b.timeHeld+= 1; yog (nias) {yog (b.timeHeld> (THRESH_1/(1+DELAY)))) {b.state = States:: tuav; }} lwm tus {// yog (b.timeHeld

int getButtonStateCode (khawm b)

{rov qab b.state*pintobin (b.pin); }

int getCodeByButton (int chaws, int index) {

hauv r1, r2, r3, r4, r5; int opStep = BUTTON_NUM - (1+qhov ntsuas);

// thawj qhov haujlwm

yog (opStep == 0) rov qab chaws/10000; r1 = chaws%10000;

yog (opStep == 1)

rov r1/1000; r2 = r1%1000; yog (opStep == 2) rov r2/100; r3 = r2%100; yog (opStep == 3) rov r3/10; r4 = r3%10; yog (opStep == 4) rov r4/1; r5 = r4%1; }

void completePress (int tus pin) {

// Serial.print ("tswv yim"); // Serial.println (tus pin); ncua (THRESH_3); Keyboard.releaseAll (); }

void doAction (int code) {

// Modifiers if (getCodeByButton (code, 0) == 2) {// Serial.println ("--- modifiers ----"); yog (getCodeByButton (code, 1)> 0) {Keyboard.press (altKey); // Serial.println ("------- alt ---------"); } lwm Keyboard.release (altKey); yog (getCodeByButton (code, 2)> 0) {Keyboard.press (ctrlKey); // Serial.println ("-------- ctrl ----------"); } lwm Keyboard.release (ctrlKey); yog (getCodeByButton (code, 3)> 0) {Keyboard.press (''); } lwm Keyboard.release (''); yog (getCodeByButton (code, 4)> 0) {Keyboard.press (shiftKey); // Serial.println ("------ hloov ------"); } lwm Keyboard.release (shiftKey); lwm yam {

// ua cov haujlwm

hloov (chaws) {rooj plaub 30: // --- | Txhuam Keyboard.press (shiftKey); Keyboard.print ('b'); completePress (chaws); tawg; rooj plaub 300: // --- | Lwv Keyboard.press (shiftKey); Keyboard.print ('e'); completePress (chaws); tawg; rooj plaub 3000: // --- | Thoob Keyboard.press (shiftKey); Keyboard.print ('g'); completePress (chaws); tawg; rooj plaub 30000: // --- | Lasso Keyboard.press (shiftKey); Keyboard.print ('l'); completePress (chaws); tawg; rooj plaub 320: //-| o Undo Keyboard.press (ctrlKey); Keyboard.print ('z'); completePress (chaws); tawg; rooj plaub 3020: //-| -o Redo Keyboard.press (ctrlKey); Keyboard.print ('y'); completePress (chaws); tawg; rooj plaub 30020: // |-keeb kwm Keyboard.press (shiftKey); Keyboard.print ('y'); completePress (chaws); tawg; cas 230: //-o | Txuag Keyboard.press (ctrlKey); Keyboard.print ('tus'); completePress (chaws); tawg; rooj plaub 3200: //- | o- Quick-p.webp

int buttonCode = 0;

rau (int i = 0; i <BUTTON_NUM; ++ i) {nyees khawm = buttonStateUpdate (nyees khawm ); buttonCode+= getButtonStateCode (khawm ); }

yog (buttonCode! = 0) {

Serial.print ("khawm chaws:"); Serial.println (buttonCode); }

doAction (buttonCode);

// tso koj tus lej tseem ceeb ntawm no, kom rov ua dua: // rau (int i = nyees khawm [0]; kuv <sizeof (nyees khawm)/sizeof (nyees khawm [0])+khawm [0]; ++ i) {/ / // yog (readButton (i)) {// doAction (i); //} //}

yog (getCodeByButton (buttonCode, 0)! = 2)

Keyboard.releaseAll ();

ncua (DELAY);

}

Tsis muaj ntau yam hais txog cov laj thawj vim nws zoo ib yam li kuv tus tswj hwm zaum kawg, nrog ob qhov sib txawv tseem ceeb:

  1. Cov nyees khawm yog teeb tsa nrog lawv tus kheej lub xeev cov tshuab
  2. Cov xeev tau suav ua ke los ua cov cai uas txiav txim siab qhov kev nqis tes ua

Lub hauv paus ntsiab lus zoo ib yam li hloov pauv me ntsis, tab sis vim tias cov nyees khawm muaj ntau lub xeev thiab tsis tuaj yeem yooj yim sawv cev nrog binary, lawv tau sib tw los ntawm lub zog kaum. Tom qab ntawd kuv ntxiv txhua lub xeev khawm mus rau hauv ib tus lej, thiab dhau nws mus rau doAction () hloov nqe lus, qhov uas kuv tso tag nrho cov lej luv.

Raws li koj tuaj yeem pom, Kuv tsis tau qhia txhua qhov ua tau ua ke. Kuv tsuas yog ntxiv qee qhov kuv nyiam luv luv, kuv tso nws rau koj txhawm rau sau qhov seem uas koj pom zoo tshaj plaws;)

Kauj ruam 3: Casing

Casing
Casing
Casing
Casing
Casing
Casing

Kuv siv lub tshuab luam ntawv 3D rau lub casing. Raws li koj tuaj yeem pom, tus tsim muaj qee qhov tsis raug thiab kuv yuav tsum tau MacGyver ib txoj hauv kev tsuas yog kaw nws. Yog li kuv yuav tsis tau tshaj tawm cov qauv ntawv tsuas yog tsis tau.

Cov nyees khawm tau kub-lo rau "lub rooj zaum" kom lawv khaws lub kaus mom nyob hauv qhov chaw. Lub pob khawm muag tshwj xeeb yog qhov zoo ntawm qhov ntawd, yog li nco ntsoov tau txais qee qhov yog tias koj npaj yuav ua rooj plaub zoo ib yam li kuv li.

Tsis tas li, kuv hais kom ntxiv qhov hnyav me ntsis hauv rooj plaub, vim nws yog lub teeb heev. Cov grams ntxiv yuav ua rau tuav nws zoo li ntuj tsim.

Solder txhua yam raws li qhia thiab txuas usb cable, thiab txhua yam yuav tsum haum rau hauv qhov chaw (nrog kev pab los ntawm qee cov kua nplaum)!

Kauj Ruam 4: Qhov tshwm sim thiab Kev Txhim Kho Tau

Cov txiaj ntsig thiab Kev Txhim Kho Tau
Cov txiaj ntsig thiab Kev Txhim Kho Tau
Cov txiaj ntsig thiab Kev Txhim Kho Tau
Cov txiaj ntsig thiab Kev Txhim Kho Tau
Cov txiaj ntsig thiab Kev Txhim Kho Tau
Cov txiaj ntsig thiab Kev Txhim Kho Tau

Muaj koj muaj nws! Tus tswj tuav nrog koj tuaj yeem siv nkag mus rau tag nrho koj cov kev luv luv nrog tsuas yog siv ib txhais tes!

Nws siv qee cov leeg-nco siv, tab sis nws muaj ntau yam tiag tiag!

Tau kawg nws tsis zoo tag nrho, thiab tam sim no kuv tab tom xav txog qee txoj hauv kev los txhim kho nws. Ib cag los ntawm kev txhim kho cov ntaub ntawv thiab ntxiv cov ntawv luv luv, Kuv xav tias kuv yuav txaus siab los txhawb nqa ntau daim ntawv thov nrog kev sib txawv luv luv. Kuv tab tom xav kom muaj khawm ua ke kom hloov ntawm kev tswj hwm lub tswv yim, zoo li nias 4 khawm tib lub sijhawm kom hloov ntawm Photoshop lub tsev qiv ntawv luv luv rau ib tus kws txiav rau Maya.

Tsuas yog qee lub tswv yim.

Ua tsaug rau kev nyeem ntawv, txog rau lub sijhawm tom ntej!

Pom zoo: