Cov txheej txheem:

Yuav Ua Li Cas Ua Arduino Guitar Tuner: 4 Kauj Ruam
Yuav Ua Li Cas Ua Arduino Guitar Tuner: 4 Kauj Ruam

Video: Yuav Ua Li Cas Ua Arduino Guitar Tuner: 4 Kauj Ruam

Video: Yuav Ua Li Cas Ua Arduino Guitar Tuner: 4 Kauj Ruam
Video: qhias ntau guitar "Ua kawg peev xwm" lyrics chords. 2024, Kaum ib hlis
Anonim
Yuav Ua Li Cas Ua Arduino Guitar Tuner
Yuav Ua Li Cas Ua Arduino Guitar Tuner

Cov no yog cov lus qhia los ua tus ntaus suab paj nruag tawm ntawm Arduino thiab ntau yam ntxiv. Nrog kev paub yooj yim ntawm cov khoom siv hluav taws xob thiab cov lej koj yuav muaj peev xwm ua tus ntaus kis las no.

Thawj yam ua ntej koj yuav tsum paub tias cov ntaub ntawv yog dab tsi.

Cov ntaub ntawv:

- 1 Arduino (Kuv siv Arduino 1)

- 1 LCD Zaub (16x2)

- 1 Potentiometer

- 1 Electret Microphone

-1 250 Ohm Resistor

- Ntau cov xov hlau

-Soldering Hlau

- 1 Peev

Kauj Ruam 1: Soldering Pins

Soldering Pins
Soldering Pins

Thawj qhov koj yuav tsum tau ua yog muab cov laug txuas tso rau ntawm LCD, txawm li cas los xij koj yuav tsum ua kom ntseeg tau tias lawv tau siv txoj hauv kev kom raug. Hauv daim duab saum toj no, nws qhia tau tias tus pin twg yuav tsum txuas nrog qhov twg. Tus GND tus pin yuav tsum txuas nrog lub davhlau ya nyob twg ntawm lub hwj chim zoo li hauv daim duab Tinkercad. (NCO TSEG: Nws yog ib qho tseem ceeb heev uas koj txuas tus pin raws li tau qhia, txwv tsis pub lub tuner yuav tsis ua haujlwm.)

Kauj Ruam 2: Txuas Txhua Yam

Txuas Txhua Yam
Txuas Txhua Yam

Tom qab muab cov xov hlau txuas rau lub LCD muaj ob peb lwm cov xov hlau uas koj xav tau txuas.

1.) Thawj qhov koj yuav tsum tau ua yog txuas GND thiab 5V ntawm Arduino mus rau lub khob cij kom nws muaj hwj chim. Tom qab ntawd txuas lub electret rau tus lej digital 7 thiab GND.

2.) Tom qab ntawd txuas lub piezo mus rau lub khob cij rau GND thiab txuas nws mus rau tus lej digital 6.

3.) Tom qab ntawd mus rau lub zog ntsuas, koj txuas lub davhlau ya nyob twg 1 mus rau qhov zoo ntawm lub khob cij thiab lub davhlau ya nyob twg 2 mus rau GND kab txaij ntawm lub khob cij, tom qab ntawd koj txuas lub wiper rau tus pin sib piv ntawm LCD.

Kauj ruam 3: Coding

Coding
Coding

Thaum koj tau txuas txhua yam kom raug, koj yuav tsum tau teeb tsa lub tuner kom nws thiaj li ua tau nws txoj haujlwm. Hauv qab no yog cov cai

// suav nrog lub tsev qiv ntawv chaws:#suav nrog

// pib lub tsev qiv ntawv nrog tus lej ntawm tus lej sib cuam tshuam LiquidCrystal lcd (12, 11, 5, 4, 3, 2);

UA = 440;

IB = 494;

ua C = 523;

ua D = 587;

yog E = 659;

yog F = 699;

yog G = 784;

int siab A = 880;

int buzzer = 8; int functionGenerator = A1;

void teeb tsa () {

// teeb tsa LCD tus lej ntawm kab thiab kab:

lcd.begin (16, 2);

// Luam tawm cov lus rau LCD.

lcd.print ("nyob zoo, ntiaj teb!");

Serial.begin (9600);

// tshem txhua yam hauv LCD, tom qab ntawv teeb tus cursor, luam tawm

lcd.setCursor (0, 1); }

void voj () {

Serial.println (analogRead (functionGenerator));

ncua (50);

// teeb tus cursor rau kab 0, kab 1

// (ceeb toom: kab 1 yog kab thib ob, vim suav suav nrog 0):

yog (analogRead (functionGenerator) == 450) {

lcd.clear ();

lcd.setCursor (8, 1);

suab nrov (buzzer, 250);

lcd.print ("A");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator) == 494) {

lcd.clear ();

lcd.setCursor (8, 1);

suab nrov (buzzer, 250);

lcd.print ("B");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator) == 523) {

lcd.clear ();

lcd.setCursor (8, 1);

suab nrov (buzzer, 250);

lcd.print ("C");

ncua (1000);

} lwm yog (analogRead (functionGenerator) == 587) {

lcd.clear ();

lcd.setCursor (8, 1);

suab nrov (buzzer, 250);

lcd.print ("D");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator) == 659) {

lcd.clear ();

lcd.setCursor (8, 1);

suab nrov (buzzer, 250);

lcd.print ("E");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator) == 699) {

lcd.clear ();

lcd.setCursor (8, 1);

suab nrov (buzzer, 250);

lcd.print ("F");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator) == 784) {

lcd.clear ();

lcd.setCursor (8, 1);

suab nrov (buzzer, 250);

lcd.print ("G");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator) == 880) {

lcd.clear ();

lcd.setCursor (8, 1);

suab nrov (buzzer, 250);

lcd.print ("A");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 400 && digitalRead (functionGenerator) <449) {

lcd.clear ();

lcd.setCursor (4, 1);

suab nrov (buzzer, 250);

lcd.print ("A");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 451 && digitalRead (functionGenerator) <470) {

lcd.clear ();

lcd.setCursor (12, 1);

suab nrov (buzzer, 250);

lcd.print ("A");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 471 && digitalRead (functionGenerator) <493) {

lcd.clear ();

lcd.setCursor (4, 1);

suab nrov (buzzer, 250);

lcd.print ("B");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 495 && digitalRead (functionGenerator) <509) {

lcd.clear ();

lcd.setCursor (12, 1);

suab nrov (buzzer, 250);

lcd.print ("B");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 509 && digitalRead (functionGenerator) <522) {

lcd.clear ();

lcd.setCursor (4, 1);

suab nrov (buzzer, 250);

lcd.print ("C");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 524 && digitalRead (functionGenerator) <556) {

lcd.clear ();

lcd.setCursor (12, 1);

suab nrov (buzzer, 250);

lcd.print ("C");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 557 && digitalRead (functionGenerator) <586) {

lcd.clear ();

lcd.setCursor (4, 1);

suab nrov (buzzer, 250);

lcd.print ("D");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 588 && digitalRead (functionGenerator) <620) {

lcd.clear ();

lcd.setCursor (12, 1);

suab nrov (buzzer, 250);

lcd.print ("D");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 621 && digitalRead (functionGenerator) <658) {

lcd.clear ();

lcd.setCursor (4, 1);

suab nrov (buzzer, 250);

lcd.print ("E");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 660 && digitalRead (functionGenerator) <679) {

lcd.clear ();

lcd.setCursor (12, 1);

suab nrov (buzzer, 250);

lcd.print ("E");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 680 && digitalRead (functionGenerator) <698) {

lcd.clear ();

lcd.setCursor (4, 1);

suab nrov (buzzer, 250);

lcd.print ("F");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 700 && digitalRead (functionGenerator) <742) {

lcd.clear ();

lcd.setCursor (12, 1);

suab nrov (buzzer, 250);

lcd.print ("F");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 743 && digitalRead (functionGenerator) <783) {

lcd.clear ();

lcd.setCursor (4, 1);

suab nrov (buzzer, 250);

lcd.print ("G");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 785 && digitalRead (functionGenerator) <845) {

lcd.clear ();

lcd.setCursor (12, 1);

suab nrov (buzzer, 250);

lcd.print ("G");

ncua (1000);

} lwm tus yog (analogRead (functionGenerator)> 846 && digitalRead (functionGenerator) <879) {

lcd.clear ();

lcd.setCursor (4, 1);

suab nrov (buzzer, 250);

lcd.print ("A");

ncua (1000); }

lwm {noTone (buzzer); } ncua (10); }

Kauj Ruam 4: Txuas Nws Rau Lub Hwj Chim

Txuas Nws Rau Lub Hwj Chim
Txuas Nws Rau Lub Hwj Chim

Rau cov kauj ruam kawg txhua yam koj yuav tsum ua yog nrhiav lub zog thiab txuas nws mus rau Arduino, ib qho uas koj muaj uas koj tuaj yeem pib siv lub tuner.

Pom zoo: