Laboratoriya ishlari. Tayyorladi: Ubaydullayeva Dilshoda. Qabul qildi: Turg’unov Bahodir. Laboratoriya ishi №19. Buzzer(Piezo emitent). Laboratoriya ishining maqsadi


Download 1.88 Mb.
bet3/9
Sana19.06.2023
Hajmi1.88 Mb.
#1603429
1   2   3   4   5   6   7   8   9
Bog'liq
19-24-laboratoriya mashg\'ulotlari

Laboratoriya ishi № 20.
Piezo nazorati: ohang o‘zgartirish, davomiylikni o‘zgartirish.
Laboratoriya ishining maqsadi: Piezo emitentlarni boshqarishni, ohangni o‘zgartirishni, davomiyligini o‘zgartirishni va loyihalarda ishlatishni o‘rganish.
Laboratoriyaning nazariy qismi.
Piezoelektrik element - bu elektromekanik transduser, uning turlaridan biri piezoelektrik ovoz chiqaruvchi bo‘lib, uni piezoelektrik karnay deb ham atashadi, shunchaki qo‘ng‘iroq yoki inglizcha buzzer. Piezo karnay elektr kuchlanishini membrananing tebranishiga aylantiradi. Bu tebranishlar tovush (tovush to‘lqini) hosil qiladi.
Buzzer ovozini chiqarishning eng oddiy usullaridan biri "analogwrite" funktsiyasidan foydalanishdir. Ammo o‘rnatilgan funktsiyalarni ishlatish yaxshiroqdir. "Ton ()" funktsiyasi ovozli bildirishnomani ishga tushirish uchun javobgardir; qavs ichida foydalanuvchi ovoz chastotasi va kirish raqamining parametrlarini hamda vaqtni ko‘rsatishi kerak. Ovozni o‘chirish uchun "noTone ()" funktsiyasidan foydalaning.
Laboratoriyaning amaliy qismi.
Modelni yig‘ish uchun bizga quyidagilar kerak:



Modelning Arduinoga ulanish sxemasi:

Ushbu model uchun quyidagi dastur yozamiz:
Kod qism:

// C++ code


//
int DO = 0;

int RE = 0;

int MI = 0;

int FA = 0;

int SOL = 0;

int LA = 0;

int SI = 0;

void setup()


{
pinMode(3, OUTPUT);
}

void loop()


{
DO = 60;
RE = 62;
MI = 64;
FA = 65;
SOL = 67;
LA = 69;
SI = 71;
tone(3, 440 * pow(2.0, (constrain(int(SOL), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(FA), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(SOL), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(LA), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(SOL), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(FA), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(MI), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(RE), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(FA), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(MI), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(RE), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(MI), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(SOL), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(FA), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(SOL), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(LA), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(SOL), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(FA), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(MI), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(RE), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(FA), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(MI), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(RE), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
tone(3, 440 * pow(2.0, (constrain(int(DO), 35, 127) - 57) / 12.0), 1000);
delay(250); // Wait for 250 millisecond(s)
}


Download 1.88 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling