Cov txheej txheem:

Keyboard Ntsuas Nrog Arduino (los ntawm Phau Ntawv Arduino): 6 Cov Kauj Ruam
Keyboard Ntsuas Nrog Arduino (los ntawm Phau Ntawv Arduino): 6 Cov Kauj Ruam

Video: Keyboard Ntsuas Nrog Arduino (los ntawm Phau Ntawv Arduino): 6 Cov Kauj Ruam

Video: Keyboard Ntsuas Nrog Arduino (los ntawm Phau Ntawv Arduino): 6 Cov Kauj Ruam
Video: HMONG World Mosquito Destroyer 2024, Kaum ib hlis
Anonim
Image
Image

Nov yog kev qhia yuav ua li cas los tsim cov twj keyboard nrog Arduino. Nws tsuas yog siv 6 kauj ruam, uas yog qhov yooj yim rau cov pib siv pib nrog Arduino. Qhov tshwm sim ntawm txoj haujlwm zoo li zoo li lub cuab yeej cuam tshuam ntau dua li cov hlua. Muaj 4 daim ntawv suav nrog: C, D, E, thiab F.

Kauj Ruam 1: Cov khoom siv

Circuit Court
Circuit Court

Nov yog cov npe khoom siv rau txoj haujlwm no:

- Ib Arduino Uno

- Breadboard (qhov loj me tsis muaj teeb meem, thiab tsis tas yuav txuas nrog Arduino)

- Piezo ib

- 4 Laub Khawm

-4 Resistors

- 2 10k Ohms Resistor (xim av, dub, txiv kab ntxwv)

- 220 Ohms Resistor (liab, liab, xim av)

- 1M Ohms Resistor (xim av, dub, ntsuab)

- 9 Cov xov hlau (qhov ntev tsis muaj teeb meem, cov xov hluav taws xob luv uas tuaj yeem haum, zoo dua lub rooj tsavxwm zoo li)

Ntxiv rau: - tus hloov pauv uas tuaj yeem pab xa cov lej los ntawm lub khoos phis tawj/laptop mus rau Arduino

Kauj ruam 2: Circuit Court

Circuit Court
Circuit Court

Tom qab tag nrho cov khoom siv tau npaj, peb tuaj yeem txav mus rau tsim qhov Circuit. Nov yog ob daim duab ntawm Circuit Court. Ib qho yog cov txheej txheem, thiab lwm qhov yog qhov zoo ntawm pawg thawj coj saib. Nkawd ob leeg yog lawm. Nws yog qhov zoo los ua raws li ob txoj hauv kev los tsim lub Circuit Court, txawm hais tias qhov zoo ib qho yog me ntsis ncaj ncaj rau pem hauv ntej.

(Hauv txoj haujlwm no txhua lub Cheebtsam tsis muaj qhov sib txawv, uas txhais tau tias nws yuav tsum ua haujlwm ob qho tib si ob txhais ceg tau muab tso rau hauv lub rooj tsavxwm)

Kauj ruam 3: Codes

Codes
Codes

Nov yog cov lej rau txoj haujlwm no:

cov nyees khawm [0];

int ntawv = {262, 294, 330, 349};

teeb tsa tsis muaj dab tsi () {Serial.begin (9600); }

void voj () {

int keyVal = analogRead (A0);

Serial.println (keyVal);

yog (keyVal == 1023) {lub suab (8, sau ntawv [0]); }

lwm yog (keyVal> = 990 && keyVal <= 1010) {tone (8, notes [1])); }

lwm tus yog (keyVal> = 505 && keyVal <= 515) {tone (8, notes [2])); }

lwm yog (keyVal> = 5 && keyVal <= 10) {tone (8, notes [3])); }

lwm {noTone (8); }

}

(yam yuav tsum tau ceeb toom: tsis txhob hnov qab muab tus lej cim tom qab txhua kab; tom qab txhua tus lej tau ua tiav txheeb xyuas nws los ntawm nyem rau ntawm lub cim kos rau ntawm kaum sab laug saum toj, tom qab nyem nws, nws xav kom koj khaws nws; tom qab cov lej tau ua txheeb xyuas, mus rau Cov Cuab Yeej, ntawm no yog ob yam hauv qab cov ntsiab lus no uas yuav tsum tau ua: 1. Pawg thawj coj, xaiv "Arduino/Genuino Uno"; Chaw nres nkoj, xaiv qhov kev xaiv nkaus xwb, *** qhov no tseem ceeb heev)

Kauj Ruam 4: Upload Cov Cai

Upload cov Codes
Upload cov Codes
Upload cov Codes
Upload cov Codes
Upload cov Codes
Upload cov Codes

Txhawm rau rub cov lej los ntawm khoos phis tawj/khoos phis tawj mus rau Arduino, xav tau tus hloov pauv, nws muaj ib sab uas txuas rau Arduino, thiab lwm sab yog USB txuas.

(lub adapter yuav tsum suav nrog los ntawm cov khoom siv Arduino.)

Kauj ruam 5: Troubleshoot

Teeb meem
Teeb meem

Yog tias txhua yam tau ua tiav los ntawm qib 1 ~ qib 4, tab sis nws tsis ua haujlwm, ntawm no yog cov npe khoom uas tuaj yeem ua tau:

- ob zaug txheeb xyuas txhua qhov kev sib txuas kom pom tias lawv tau sib txuas nruj lossis tsis, suav nrog cov xov hlau, khawm, cov tiv thaiv, thiab piezo

- ob zaug txheeb xyuas cov lej yog tias lawv tau muab tso lossis tsis tau

- yog tias cov roj teeb tau koom nrog, thaum nws tau txuas nrog Arduino, tab sis tsis muaj lub teeb taws teeb ntawm Arduino pawg thawj coj, nws txhais tau tias nws tsis muaj roj teeb.

Kauj Ruam 6: Cov Lus Qhia Me

Ntsis me me
Ntsis me me

Tom qab teeb meem, thiab pom qhov ua yuam kev, hloov pauv tuaj yeem ua tau. Yog tias qhov kev hloov pauv hais txog kev sib txuas lossis qhov sib txawv (tsis nyob hauv txoj haujlwm no), uas tsis muaj dab tsi ua nrog txoj cai, peb ib txwm tuaj yeem nias lub pob pib dua no ntawm Arduino board. Ua li ntawd, peb tsis tas yuav rov tso cov lej tom qab txhua lub sijhawm peb hloov pauv cov kev sib txuas.

Pom zoo: