Cov txheej txheem:

Arduino Bascis - Ua Si Suab thiab Tones: 5 Kauj Ruam
Arduino Bascis - Ua Si Suab thiab Tones: 5 Kauj Ruam

Video: Arduino Bascis - Ua Si Suab thiab Tones: 5 Kauj Ruam

Video: Arduino Bascis - Ua Si Suab thiab Tones: 5 Kauj Ruam
Video: Lam hu ua si xb xob xav li cag nb yg nyiam no pab niag thiab pab ₫a ký rau og 2024, Hlis ntuj nqeg
Anonim
Image
Image

Kuv xav ua qee qhov cuam tshuam suab, thiab pom tau tias qhov no yog ib qho ntawm qhov tsis saib tsis xyuas thaum nws los txog rau kev qhia. Txawm tias hauv Youtube, tsis muaj kev qhia zoo ntawm Arduinos thiab suab, yog li, kuv yog tus txiv leej tub zoo, txiav txim siab qhia kuv qhov kev paub ntawm Arduinos.

Yog tias koj tsis tau nyeem, ntawm no yog daim vis dis aus tag nrho nrog lub suab tiag tiag tau ua si:

Kauj Ruam 1: Ua ntej, Cov hauv paus

Txuas Cov Hais Lus rau Arudino
Txuas Cov Hais Lus rau Arudino

Yog tias koj puas tau yuav ib qho khoom siv Arduino Starter, feem ntau lawv muaj ib qho Active Buzzer/ Speaker thiab ib qho Passive Buzzer/ Speaker.

Yog li leej twg yog leej twg?

Qhov pom kev sib txawv yog cov hauv qab no:

- Tus Hais Lus nquag yog feem ntau siab dua Passive

- Tus Hais Lus nquag tau kaw rau hauv qab, tab sis Tus Hais Lus Passive tau qhib hauv qab.

Cov txuj ci sib txawv yog tias Tus hais lus nquag tau tsim hauv Cov Cheeb Tsam nquag uas tso cai rau nws ua haujlwm nrog DC Voltage.

Yog li, yog tias peb thov 5V lossis 3V muab rau tus hais lus nquag, nws nrov nrov, thaum tus neeg hais lus Passive ua haujlwm nrog AC voltage, lossis PWM DC Teeb liab.

Tam sim no peb paub qhov sib txawv, cia mus tom ntej thiab txuas lawv.

Kauj Ruam 2: Txuas Tus Hais Lus rau Arudino

Cov kev sib txuas yog yooj yim.

Ib qho ntawm PWM tus pin (PIns 2 txog 13) txuas nrog qhov zoo ntawm tus hais lus, thiab qhov tsis zoo txuas nrog 100 ohm resistor, uas txuas nrog hauv av.

Tam sim no, peb tuaj yeem mus rau peb daim duab kos/ chaws.

Kauj Ruam 3: Txoj Cai

Txoj Cai
Txoj Cai

Txoj Cai yog ib kab nkaus xwb!

Yog tias koj xav tsuas yog ua suab ib leeg, cov hauv qab no yog txhua yam uas xav tau:

suab (tus pin, zaus, sijhawm)

Qhov twg tus pin, yog tus Pin tus hais lus txuas nrog, qhov zaus yog zaus (hauv Hertz), thiab lub sijhawm nyob hauv milliseconds, yog nyob ntawm yeem.

Yooj yim, txoj cai? Cia peb ua qee yam ntxim nyiam dua.

Kauj Ruam 4: Ua Si Supermario Tone

Ua si Supermario Tone
Ua si Supermario Tone

Cov hauv qab no tuaj yeem siv los ua suab nrov Supermario!

Tsuas yog muab tshuaj txhuam, thiab txaus siab rau:

Arduino Mario Bros Tunes Nrog Piezo Buzzer thiab PWM los ntawm: Dipto Pratyaksa hloov kho zaum kawg: 31/3/13 */#include

#define melodyPin 3 // Mario lub ntsiab lus tseem ceeb melody int melody = {NOTE_E7, NOTE_E7, 0, NOTE_E7, 0, NOTE_C7, NOTE_E7, 0, NOTE_G7, 0, 0, 0, NOTE_G6, 0, 0, 0, 0, NOTE_C7, 0, 0, NOTE_G6, 0, 0, NOTE_E6, 0, 0, NOTE_A6, 0, NOTE_B6, 0, NOTE_AS6, NOTE_A6, 0, NOTE_G6, NOTE_E7, NOTE_G7, NOTE_A7, 0, NOTE_F7, NOTE_G7, 0, NOTE_E7, 0, NOTE_C7, NOTE_D7, NOTE_B6, 0, 0, NOTE_C7, 0, 0, NOTE_G6, 0, 0, NOTE_E6, 0, 0, NOTE_A6, 0, NOTE_B6, 0, NOTE_AS6, NOTE_A6, 0, NOTE_G6, NOTE_E7, NOTE_G7, NOTE_A7, 0, NOTE_F7, NOTE_G7, 0, NOTE_E7, 0, NOTE_C7, NOTE_D7, NOTE_B6, 0, 0} // Mario main them tempo int tempo = {12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 9, 9, 9, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 9, 9, 9, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, };

//

Kauj ruam 5: Dab tsi ntxiv?

Koj xav ua dab tsi nyuaj dua? Zoo li Suab Nkauj, lossis suab cuam tshuam nrog koj Arduino? Zoo, Arduino nco tau txwv, yog li nws tsis tuaj yeem ua piv txwv tones ntawm tus nqi siab dua. Yog tias koj yuav tsum tau ua qee yam zoo nkauj, koj yuav xav tau daim npav SD txuas nrog Arduino thiab ua lub suab los ntawm daim npav. Cia siab tias koj tau kawm qee yam los ntawm qhov no!

Txiav txim siab tso npe rau Fungineers hauv Youtube; muaj kev qhia, DIY khoom, 3D luam ntawv geek-ery txhua lub lim tiam!

Pom zoo: