Mundarija:

Arduino gitara sozlagichini qanday qilish kerak: 4 qadam
Arduino gitara sozlagichini qanday qilish kerak: 4 qadam

Video: Arduino gitara sozlagichini qanday qilish kerak: 4 qadam

Video: Arduino gitara sozlagichini qanday qilish kerak: 4 qadam
Video: arduino play guitar 2024, Dekabr
Anonim
Arduino gitara sozlagichini qanday qilish kerak
Arduino gitara sozlagichini qanday qilish kerak

Bu Arduino va boshqa bir qancha komponentlardan gitara sozlagichini tayyorlash bo'yicha ko'rsatmalar. Elektronika va kodlash bo'yicha asosiy bilimlarga ega bo'lsangiz, siz ushbu gitara sozlagichini yasashingiz mumkin bo'ladi.

Avvalo, siz qanday materiallar kerakligini bilishingiz kerak.

Materiallar:

- 1 Arduino (men Arduino 1 ishlatardim)

- 1 ta LCD displey (16x2)

- 1 ta potentsiometr

- 1 elektretli mikrofon

- 1 250 Ohm qarshilik

- Bir nechta simlar

-Lehimlash temir

- 1 ta piezo

1 -qadam: payvandlash pinlari

Lehim pinlari
Lehim pinlari

Siz qilishingiz kerak bo'lgan birinchi narsa - pinlarni LCD -ga lehimlash, lekin siz ularning to'g'ri lehimlanganligiga ishonch hosil qilishingiz kerak. Yuqoridagi rasmda qaysi pinlar qayerga ulanishi kerakligini ko'rsatadi. GND pimi Tinkercad diagramasidagi kabi potentsiometr terminaliga ulangan bo'lishi kerak. (QAYD: Pimlarni ko'rsatmalarga muvofiq ulash juda muhim, aks holda tyuner ishlamaydi.)

2 -qadam: Hammasini ulash

Hamma narsani bog'lash
Hamma narsani bog'lash

Simlarni LCDga lehimlagandan so'ng, siz ulashingiz kerak bo'lgan boshqa bir nechta simlar mavjud.

1.) Siz qilishingiz kerak bo'lgan birinchi narsa - Arduino -dagi GND va 5V -ni quvvat paneliga ulash. Keyin elektretni raqamli pin 7 va GND ga ulang.

2.) Keyin piezoni GND uchun non paneliga ulang va uni raqamli pin 6 ga ulang.

3.) Potansiyometr ishga tushgandan so'ng, siz 1 -terminalni non panelidagi ijobiy tasmaga, 2 -terminalini esa non panelidagi GND tasmasiga ulaysiz, so'ngra o'chirgichni LCD displeyidagi kontrastli pinga ulaysiz.

3 -qadam: kodlash

Kodlash
Kodlash

Hamma narsani to'g'ri ulaganingizdan so'ng, siz tyunerni o'z vazifasini bajarishi uchun dasturlashingiz kerak. Kod quyida

// kutubxona kodini o'z ichiga oladi: #include

// kutubxonani LiquidCrystal lcd interfeys pinlari (12, 11, 5, 4, 3, 2) raqamlari bilan ishga tushiring;

int A = 440;

int B = 494;

int C = 523;

int D = 587;

int E = 659;

int F = 699;

int G = 784;

int yuqoriA = 880;

int buzzer = 8; int funktsiyasiGenerator = A1;

bo'sh o'rnatish () {

// LCD -ning ustunlar va qatorlar sonini o'rnating:

lcd.begin (16, 2);

// Xabarni LCD displeyga chop eting.

lcd.print ("salom, dunyo!");

Serial.begin (9600);

// LCD -dagi hamma narsani tozalang, keyin kursorni, printt -ni o'rnating

lcd.setCursor (0, 1); }

void loop () {

Serial.println (analogRead (functionGenerator));

kechikish (50);

// kursorni 0 -ustun, 1 -qatorga o'rnating

// (eslatma: 1 -qator - ikkinchi qator, chunki sanash 0 bilan boshlanadi):

agar (analogRead (functionGenerator) == 450) {

lcd.clear ();

lcd.setCursor (8, 1);

ohang (signal, 250);

lcd.print ("A");

kechikish (1000);

} if if (analogRead (functionGenerator) == 494) {

lcd.clear ();

lcd.setCursor (8, 1);

ohang (signal, 250);

lcd.print ("B");

kechikish (1000);

} if if (analogRead (functionGenerator) == 523) {

lcd.clear ();

lcd.setCursor (8, 1);

ohang (signal, 250);

lcd.print ("C");

kechikish (1000);

} if if (analogRead (functionGenerator) == 587) {

lcd.clear ();

lcd.setCursor (8, 1);

ohang (signal, 250);

lcd.print ("D");

kechikish (1000);

} else if (analogRead (functionGenerator) == 659) {

lcd.clear ();

lcd.setCursor (8, 1);

ohang (signal, 250);

lcd.print ("E");

kechikish (1000);

} agar boshqa (analogRead (functionGenerator) == 699) {

lcd.clear ();

lcd.setCursor (8, 1);

ohang (signal, 250);

lcd.print ("F");

kechikish (1000);

} else if (analogRead (functionGenerator) == 784) {

lcd.clear ();

lcd.setCursor (8, 1);

ohang (signal, 250);

lcd.print ("G");

kechikish (1000);

} if if (analogRead (functionGenerator) == 880) {

lcd.clear ();

lcd.setCursor (8, 1);

ohang (signal, 250);

lcd.print ("A");

kechikish (1000);

} if if (analogRead (functionGenerator)> 400 && digitalRead (functionGenerator) <449) {

lcd.clear ();

lcd.setCursor (4, 1);

ohang (signal, 250);

lcd.print ("A");

kechikish (1000);

} if if (analogRead (functionGenerator)> 451 && digitalRead (functionGenerator) <470) {

lcd.clear ();

lcd.setCursor (12, 1);

ohang (signal, 250);

lcd.print ("A");

kechikish (1000);

} if if (analogRead (functionGenerator)> 471 && digitalRead (functionGenerator) <493) {

lcd.clear ();

lcd.setCursor (4, 1);

ohang (signal, 250);

lcd.print ("B");

kechikish (1000);

} if if (analogRead (functionGenerator)> 495 && digitalRead (functionGenerator) <509) {

lcd.clear ();

lcd.setCursor (12, 1);

ohang (signal, 250);

lcd.print ("B");

kechikish (1000);

} if if (analogRead (functionGenerator)> 509 && digitalRead (functionGenerator) <522) {

lcd.clear ();

lcd.setCursor (4, 1);

ohang (signal, 250);

lcd.print ("C");

kechikish (1000);

} if if (analogRead (functionGenerator)> 524 && digitalRead (functionGenerator) <556) {

lcd.clear ();

lcd.setCursor (12, 1);

ohang (signal, 250);

lcd.print ("C");

kechikish (1000);

} if if (analogRead (functionGenerator)> 557 && digitalRead (functionGenerator) <586) {

lcd.clear ();

lcd.setCursor (4, 1);

ohang (signal, 250);

lcd.print ("D");

kechikish (1000);

} if if (analogRead (functionGenerator)> 588 && digitalRead (functionGenerator) <620) {

lcd.clear ();

lcd.setCursor (12, 1);

ohang (signal, 250);

lcd.print ("D");

kechikish (1000);

} if if (analogRead (functionGenerator)> 621 && digitalRead (functionGenerator) <658) {

lcd.clear ();

lcd.setCursor (4, 1);

ohang (signal, 250);

lcd.print ("E");

kechikish (1000);

} if if (analogRead (functionGenerator)> 660 && digitalRead (functionGenerator) <679) {

lcd.clear ();

lcd.setCursor (12, 1);

ohang (signal, 250);

lcd.print ("E");

kechikish (1000);

} if if (analogRead (functionGenerator)> 680 && digitalRead (functionGenerator) <698) {

lcd.clear ();

lcd.setCursor (4, 1);

ohang (signal, 250);

lcd.print ("F");

kechikish (1000);

} if if (analogRead (functionGenerator)> 700 && digitalRead (functionGenerator) <742) {

lcd.clear ();

lcd.setCursor (12, 1);

ohang (signal, 250);

lcd.print ("F");

kechikish (1000);

} if if (analogRead (functionGenerator)> 743 && digitalRead (functionGenerator) <783) {

lcd.clear ();

lcd.setCursor (4, 1);

ohang (signal, 250);

lcd.print ("G");

kechikish (1000);

} if if (analogRead (functionGenerator)> 785 && digitalRead (functionGenerator) <845) {

lcd.clear ();

lcd.setCursor (12, 1);

ohang (signal, 250);

lcd.print ("G");

kechikish (1000);

} if if (analogRead (functionGenerator)> 846 && digitalRead (functionGenerator) <879) {

lcd.clear ();

lcd.setCursor (4, 1);

ohang (signal, 250);

lcd.print ("A");

kechikish (1000); }

else {noTone (ovozli signal); } kechiktirish (10); }

4 -qadam: uni quvvat manbaiga ulash

Uni quvvat manbaiga ulash
Uni quvvat manbaiga ulash

Oxirgi bosqichda siz faqat quvvat manbasini topishingiz va uni Arduino -ga ulashingiz kerak, siz tyunerdan foydalanishni boshlashingiz mumkin.

Tavsiya: