Cov txheej txheem:

Cyborg Computer Mouse: 4 Kauj Ruam (nrog Duab)
Cyborg Computer Mouse: 4 Kauj Ruam (nrog Duab)

Video: Cyborg Computer Mouse: 4 Kauj Ruam (nrog Duab)

Video: Cyborg Computer Mouse: 4 Kauj Ruam (nrog Duab)
Video: Jean-Michel Jarre - Fourth Rendez-Vous 2024, Kaum ib hlis
Anonim
Cyborg Computer Mouse
Cyborg Computer Mouse

Ntau txoj kev tshawb fawb qhia tias kev siv lub computer nas ib txwm muaj peev xwm ua rau phom sij. Qhov nas yog cov khoom siv hauv computer. Cov neeg siv khoos phis tawj siv nas yuav luag peb zaug ntau dua li cov keyboard. Raws li kev nthuav tawm tus nqi siab, kev txhim kho lub siab tshaj plaws ntawm lub cev thaum siv lub computer nas yog qhov tseem ceeb heev.

Txog qhov phiaj xwm tsis paub daws teeb no peb yuav ua rau hnav tau uas tso cai rau tib neeg txav mus los ntawm lub khoos phis tawj computer yam tsis tas yuav siv thev naus laus zis sab nraud. Txoj kev ntawd peb tuaj yeem siv txhais tes txav mus los yam tsis tau nyem lub cuab yeej ntawm kab rov tav. Qhov no tseem tso cai siv cov ntxaij vab tshaus thaum sawv ntsug, ua rau kev hais lus hauv qhov ncauj zoo dua.

Raws li tus qauv yuav siv qhov ntsuas ua tus joystick, tus ntiv tes nruab nrab rau kev nyem sab laug, ntiv tes ntiv tes rau sab xis thiab lub pinky rau tig thiab tua lub cuab yeej. Tus ntiv tes xoo yuav ua raws li qhov chaw uas cov nyees khawm tau nias ntawm. Txhua yam uas yuav muab ntxiv rau hauv hnab looj tes.

Khoom siv

  • (x1) Arduino Leonardo
  • (x1) Protoboard
  • (x1) Joystick module
  • (x3) Pushbutton
  • (x20 ±) Cov hlua hlau
  • (x3) Resistors ntawm 1KΩ
  • (x1) Cov hnab looj tes xaws
  • Velcro Kub silicone
  • Cov Khoom Siv Hluav Taws Xob
  • 3D luam tawm ib feem

Kauj ruam 1: Teeb Kho Vajtse

Teeb Kho Vajtse
Teeb Kho Vajtse

Peb tau suav nrog Fritzing kos duab kom nkag siab zoo ntawm kev tsim qauv. Peb pom zoo kom teeb tsa cov khoom sib txuas ntawm tus protoboard ua ntej. Txoj hauv kev ntawd koj tuaj yeem tshawb xyuas tias txhua yam ua haujlwm ua ntej siv cov laug.

Kauj Ruam 2: Tshaj Tawm Txoj Cai thiab Xeem

Thaum cov kev sib txuas ua tiav txuas USB A (M) rau micro USB B (M) los ntawm lub khoos phis tawj mus rau Arduino Leonardo thiab xa cov duab kos. Xav tias dawb los theej, hloov kho thiab txhim kho ntawm daim duab.

CEEB TOOM: Thaum koj siv Mouse.move () hais kom ua, Arduino tuav koj tus nas! Xyuas kom koj muaj kev tswj ua ntej koj siv cov lus txib. Nws tsuas yog ua haujlwm rau Arduino Leonardo, Micro lossis Due

Nov yog peb cov cai rau txoj haujlwm no:

// Txhais Pins#suav nrog; const koj mouseMiddleButton = 2; // input tus pin rau nas nruab nrab Khawm const int startEmulation = 3; // hloov mus qhib thiab tua nas emulation const int mouseLeftButton = 4; // input pin rau nas sab laug khawm const int mouseRightButton = 5; // nkag tus pin rau nas txoj cai khawm const int joystickX = A1; // joystick X axis const int joystickY = A0; // joystick Y axis

// tsis rau nyeem joystick:

tus cursorSpeed = 10; // tso zis nrawm ntawm X lossis Y txav mus rau qhov tebDelay = 5; // teb qeeb ntawm nas, hauv ms int threshold = cursorSpeed / 4; // so pib pib int center = cursorSpeed / 2; // so txoj haujlwm tus nqi int mouseMiddleState = 0;

boolean mouseIsActive = cuav; // seb puas los yog tsis tswj tus nas

int lastSwitchState = LOW; // yav dhau los hloov lub xeev

void teeb tsa () {

pinMode (pibEmulation, INPUT); // tus pin hloov pinMode (mouseMiddleButton, INPUT); // nruab nrab nas khawm tus pin pinMode (mouseLeftButton, INPUT); // sab laug nas khawm khawm pinMode (mouseRightButton, INPUT); // txoj cai nas khawm tus pin

Nas.begin (); // tswj tus nas

}

void voj () {

// nyeem qhov hloov pauv: int switchState = digitalRead (startEmulation);

// yog tias nws tau hloov pauv thiab nws siab, toggle nas lub xeev:

yog (switchState! = lastSwitchState) {yog (switchState == LOW) {mouseIsActive =! mouseIsActive; }}

// txuag lub xeev hloov rau lub voj tom ntej:

lastSwitchState = switchState;

// nyeem thiab ntsuas ob kab:

int xReading = readAxis (A1); int yReading = readAxis (A0);

// yog tias lub xeev tswj nas tau ua haujlwm, txav tus nas:

yog (mouseIsActive) {Mouse.move (xReading, yReading, 0); // (x, y, scroll nas log)}

// LOJ

// nyeem lub pob nyem thiab nyem lossis tsis nyem: // yog tias lub pob nyem tau nyem: yog (digitalRead (mouseLeftButton) == HIGH) {// yog tias tus nas tsis nias, nias nws: yog (! nas.isPressed (MOUSE_LEFT)) {Mouse.press (MOUSE_LEFT); ncua (100); // ncua kom qhib ib zaug thiab ob zaug nyem Mouse.release (MOUSE_LEFT); }}

// lwm tus nas khawm tsis raug nias:

lwm tus {// yog tias tus nas nias, tso nws: yog (Mouse.isPressed (MOUSE_LEFT)) {Mouse.release (MOUSE_LEFT); }}

// YOG

// nyeem lub pob nyem thiab nyem lossis tsis nyem: // yog tias lub pob nyem tau nyem: yog (digitalRead (mouseRightButton) == HIGH) {// yog tias tus nas tsis nias, nias nws: yog (! nas.isPressed (MOUSE_RIGHT)) {Mouse.press (MOUSE_RIGHT); ncua (100); // ncua kom qhib ib zaug thiab ob zaug nyem Mouse.release (MOUSE_RIGHT); }}

// lwm tus nas khawm tsis raug nias:

lwm tus {// yog tias tus nas nias, tso nws: yog (Mouse.isPressed (MOUSE_RIGHT)) {Mouse.release (MOUSE_RIGHT); }}

// MIDDLE

// nyeem lub pob nyem thiab nyem lossis tsis nyem: // yog tias lub pob nyem tau nyem: yog (digitalRead (mouseMiddleButton) == HIGH) {// yog tias tus nas tsis nias, nyem nws: yog (! nas.isPressed (MOUSE_MIDDLE) && mouseMiddleState == 0) {Mouse.press (MOUSE_MIDDLE); mouseMiddleState = 1; // actualiza el estado del botón}}

// lwm tus nas khawm tsis raug nias:

lwm tus {// yog tias tus nas nias, tso nws: yog (Mouse.isPressed (MOUSE_MIDDLE) && mouseMiddleState == 1) {Mouse.release (MOUSE_MIDDLE); mouseMiddleState = 0; }}

ncua (responseDelay);

}

/*

nyeem ib lub axis (0 lossis 1 rau x lossis y) thiab ntsuas qhov sib piv ntawm cov khoom siv sib xws rau thaj tsam ntawm 0 txog */

int readAxis (int thisAxis) {

// nyeem cov lus sib piv: int nyeem = analogRead (thisAxis);

// daim ntawv qhia kev nyeem los ntawm cov khoom sib piv sib piv rau ntau yam tso tawm:

nyeem = daim ntawv qhia (nyeem, 0, 1023, 0, cursorSpeed);

// yog tias cov ntawv nyeem tawm sab nraud los ntawm

// so txoj haujlwm pib, siv nws: int nrug = nyeem ntawv - nruab nrab;

yog (abs (nrug) <threshold) {nrug = 0; }

// xa qhov nrug rau qhov axis no:

rov nrug deb; }

Kauj Ruam 3: Mounting Prototype

Mounting Prototype
Mounting Prototype
Mounting Prototype
Mounting Prototype
Mounting Prototype
Mounting Prototype

Thawj kauj ruam yog xaws lub velcro rau lub hnab looj tes, koj yuav tsum xaws plaub kab ntawm velcro ib qho rau txhua tus ntiv tes. Peb xaws qhov muag muag ntawm velcro.

Txhua lub laub khawm muaj ob lub xov hlau, ib qho uas pib ntawm tus lej sib xws thiab txuas mus rau qhov zoo ntawm lub pob thiab lwm qhov ntawm cov ceg tsis zoo. Nyob rau lwm qhov kawg ntawm cov xov tooj tsis zoo peb siv cov tshuaj tiv thaiv ntawm txhua lub khawm ntxiv rau cov xov tooj tsis zoo ntawm tus joystick mus rau ib lub xov hlau kawg, uas txuas rau GND ntawm Arduino board. Tib qho kev sib txuas sib txuas ua haujlwm rau sab zoo. (3 nyees khawm thiab joystick zoo ceg)

Tom qab soldering cov dhia peb yuav muab tso rau ntawm cov tawv velcro-ib daim hlab, kom cov xov hlau yuav tau daig nyob nruab nrab. Thaum kawg peb thermo-glued tus joystick module rau 3D luam tawm daim. Hauv qab no koj tuaj yeem pom cov ntaub ntawv. STL.

Kauj Ruam 4: Pib Siv Koj Tes Ua Tus nas

Image
Image
Pib Siv Koj Tes Ua Tus nas!
Pib Siv Koj Tes Ua Tus nas!
Pib Siv Koj Tes Ua Tus nas!
Pib Siv Koj Tes Ua Tus nas!

Pov npav rau peb hauv Kev Pabcuam Kev Sib Tw yog tias koj txaus siab rau txoj haujlwm.

Pom zoo: