Cov txheej txheem:
- Kauj Ruam 1: Kauj Ruam 1: Txhim Kho Circuit
- Kauj Ruam 2: Kauj Ruam 2: Code thiab Piav Qhia
- Kauj Ruam 3: Kauj Ruam 3: Qhia Ua Yeeb Yaj Kiab
Video: Arduino Piano Nrog Laub Khawm Hloov: 3 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Tsim los ntawm: Haotian Ye
Txheej txheem cej luam
Nov yog lub rooj ntaus piano uas muaj yim lub khawm khawm hloov uas tso cai rau koj ua si ib lub octave (Do Re Mi Fa So La Si Do) thiab nrog rau ib lub octave koj tuaj yeem sim ua qee zaj nkauj uas koj nyiam. Rau txoj haujlwm no muaj qee qhov kev paub tseem ceeb uas koj yuav tsum paub ua ntej koj pib.
Ua ntej, peb yuav tsum paub cov zaus ntawm cov ntawv sau yooj yim ntawm piano.
Cov zaus tau teev tseg hauv qab no:
Ua - 261Hz
Rov - 294Hz
Kuv - 329Hz
Zaus - 349Hz
Yog li - 392Hz
Ua hauj lwm zaus - 440Hz
Si - 493 Hz
Ua - 523Hz
Qhov thib ob, Kuv yuav qhia koj yuav ua li cas tsim lub Circuit Court los ntawm kev siv cov khoom uas tuaj yeem yuav los ntawm Lee's Electronic Store. Thaum kawg , Kuv yuav nthuav qhia thiab piav qhia cov cai uas yuav tsum tau muab xa mus rau Arduino pawg thawj coj.
Yam Koj Yuav Tsum Tau:
Arduino Uno R3 (Khoom ID: 10997)
USB A rau B Cable M/M (Khoom ID: 29861)
10K Resistor * 8 (Khoom ID: 91516)
Txawv Xim ntawm Tack Hloov * 8 (Khoom ID: 3124, 31242, 31243, 31245, 31246)
Mini Hais Lus (Khoom ID: 41680)
Breadboard (Khoom ID: 106861)
Jumper Wires (Khoom ID: 21801)
Kauj Ruam 1: Kauj Ruam 1: Txhim Kho Circuit
Ua ntej tshaj, ntxig rau txhua lub laub khawm hloov thiab hais lus me me ntawm lub khob cij ib ntawm ib qho thiab phim lawv ntawm ib kab. Tom qab ntawd txuas cov pins ntawm txhua lub laub khawm hloov mus rau hauv av. Thib ob txuas 10k resistors ntawm lub zog zoo thiab lwm tus pin ntawm txhua lub laub khawm hloov. Thiab, txuas kab ntawv no rau pins 2-9 ntawm Arduino Board. Tsis tas li, txuas hauv av rau tus pin hauv av thiab lub zog zoo rau 3.3v tus pin ntawm Arduino. Thaum kawg, txuas tus hais lus mini rau tus pin 10 ntawm Arduino.
Kauj Ruam 2: Kauj Ruam 2: Code thiab Piav Qhia
Cov cai hauv qab no yog qhov kuv tau sau
const int dub = 2;
const int dawb = 3;
const int liab = 4;
const int ntsuab = 5;
const int xiav = 6;
const int dub2 = 7;
const int ntsuab2 = 8;
const int liab2 = 9;
const tus neeg hais lus = 10; // Txuas txhua lub laub khawm hloov thiab hais lus nrog arduino lub teeb liab pins
int zaus = {262, 294, 330, 349, 392, 440, 493, 523}; // array muaj txhua zaus ntawm ib lub octave
void teeb tsa () {
// muab koj cov cai teeb tsa ntawm no, kom khiav ib zaug:
pinMode (dub, INPUT);
pinMode (dawb, INPUT);
pinMode (liab, INPUT);
pinMode (ntsuab, INPUT);
pinMode (xiav, INPUT);
pinMode (dub2, INPUT);
pinMode (ntsuab2, INPUT);
pinMode (liab2, INPUT);
pinMode (tus hais lus, NTAWV);
suab (hais lus, 2000);
Serial.begin (9600);
}
void voj () {
// muab koj cov cai tseem ceeb ntawm no, kom rov ua dua:
yog tias (digitalRead (dub) == LOW) // thaum koj nias qhov "DO" laub khawm hloov
{lub suab (tus hais lus, zaus [0], 50);
ncua (50);
noTone (hais lus);}
lwm tus yog (digitalRead (dawb) == LOW) // thaum koj nias "RE" laub khawm hloov
{lub suab (tus hais lus, zaus [1], 50);
ncua (50);
noTone (hais lus);}
lwm tus yog (digitalRead (liab) == LOW) // thaum koj nias "MI" laub khawm hloov
{suab nrov (hais lus, zaus [2], 50));
ncua (50);
noTone (hais lus);}
lwm tus yog (digitalRead (ntsuab) == LOW) // thaum koj nias "FA" laub khawm hloov
{lub suab (tus hais lus, zaus [3], 50);
ncua (50);
noTone (hais lus);}
lwm tus yog (digitalRead (xiav) == LOW) // thaum koj nias "SO" laub khawm hloov
{lub suab (tus hais lus, zaus [4], 50);
ncua (50);
noTone (hais lus);}
lwm tus yog (digitalRead (black2) == LOW) // thaum koj nias "LA" laub khawm hloov
{lub suab (tus hais lus, zaus [5], 50);
ncua (50);
noTone (hais lus);}
lwm tus yog (digitalRead (ntsuab2) == LOW) // thaum koj nias "SI" laub khawm hloov
{lub suab (tus hais lus, zaus [6], 50);
ncua (50);
noTone (hais lus);}
lwm tus yog (digitalRead (red2) == LOW) // thaum koj nias qhov "DO" laub khawm hloov
{suab nrov (hais lus, zaus [7], 50));
ncua (50);
noTone (hais lus);}
lwm // thaum koj nias tsis muaj dab tsi
noTone (hais lus);
}
Ua ntej tshaj, peb yuav tsum tshaj tawm txhua lub laub khawm hloov pauv thiab hais lus raws tus pin ntawm 2 txog 10 ntawm Arduino. Txhua qhov hloov pauv sawv cev rau ib daim ntawv. Tom qab ntawd, siv ib qho kab los tso tag nrho cov zaus hauv. Tom ntej no, Yog thiab lwm nqe lus yog qhov kuv siv qhia rau Arduino paub qhov twg khawm hloov pauv kuv nias.
Thaum kawg, txuas koj Arduino board rau koj lub khoos phis tawj lossis laptop nrog usb A rau B cable. Ua ntej koj xa koj cov cai, koj tseem yuav tsum rub tawm software Arduino thiab ua qee qhov teeb tsa ua ntej. Xaiv Cov Cuab Yeej -> Pawg Thawj Coj -> Arduino/Genuino Uno; Tom qab ntawd peb yuav tsum xaiv qhov chaw sib txuas lus txuas nrog Arduino board. Xaiv Cov Cuab Yeej -> Chaw nres nkoj, tom qab ntawv qhov twg los xij lub npe hu ua "(Arduino/Genuino Uno)." Tom qab ntawd, koj tuaj yeem xa cov cai rau Arduino board.
Pom zoo:
Siv Laub Khawm ntawm Koj Li Magicbit [Magicblocks]: 5 Kauj Ruam
Siv Laub Khawm ntawm Koj Li Magicbit [Magicblocks]: Qhov kev qhia no yuav qhia koj kom siv Lub Laub Khawm ntawm koj li Magicbit siv Magicblocks. Peb tab tom siv khawv koob raws li pawg thawj coj loj hauv txoj haujlwm no uas yog raws ESP32. Yog li ntawd ib qho ESP32 pawg thawj coj loj tuaj yeem siv tau hauv txoj haujlwm no
Laub Khawm Hloov: 31 Kauj Ruam
Push Button Switch: Lub Push Button Switch yog lwm qhov sib txawv ntawm qhov hloov pauv pab. Nws yog lub ntsiab lus rau cov menyuam xiam oob khab kom lawv tuaj yeem muaj peev xwm siv cov khoom niaj hnub
Tsev Automation WiFi Teeb Hloov Nrog ESP-01 thiab Relay Module Nrog Laub Khawm: 7 Kauj Ruam
Tsev Automation WiFi Teeb Hloov Nrog ESP-01 thiab Relay Module Nrog Laub Khawm: Yog li hauv cov lus qhia dhau los peb tau teeb tsa ESP-01 nrog Tasmota siv ESP Flasher thiab txuas ESP-01 rau peb lub network wifi.Ntawm no peb tuaj yeem pib tsim nws kom qhib/tua lub teeb hloov siv WiFi lossis lub laub khawm
Rooj Bluetooth Hais Lus Nrog Pom Pom Lub Suab, Khawm Khawm thiab NFC.: 24 Kauj Ruam (nrog Duab)
Rooj Bluetooth Hais Lus Nrog Pom Pom Suab, Khawm Khawm thiab NFC.: Nyob zoo! Hauv Cov Lus Qhia no Kuv yuav qhia yuav ua li cas kuv thiaj ua Lub Rooj Sib Tham Bluetooth hais lus no uas muaj Lub Suab Pom Zoo Zoo nrog kov cov nyees khawm thiab NFC. Ua tau yooj yim ua ke nrog NFC Enabled cov cuab yeej nrog tsuas yog kov. Tsis muaj lub cev khawm
Yuav Ua Li Cas Txuas Lub Laub Khawm Nrog Suab Tawm Tswv Yim thiab Tso Tawm: 13 Kauj Ruam
Yuav Ua Li Cas Txuas Lub Laub Khawm Nrog Lub Suab Tawm Tawm thiab Tawm Tawm: Lub laub khawm yog ib qho ntawm cov hauv paus tseem ceeb rau kev ntes koj qhov kev ua. Koj tuaj yeem thawb lub pob kom ua ib yam dab tsi. Muaj ntau txoj hauv kev los siv cov nyees khawm hauv koj cov phiaj xwm (piv txwv li nyiag nkas nas thiab keyboard, lossis Arduino, gainer, MCK). Tsi