Zbekiston respublikasi raqamli texnologiyalari vazirligi muhammad al-xorazmiy nomidagi toshkent axborot texnologiyalari universiteti
Download 0.8 Mb.
|
1 2
Bog'liq1684254203 (1)
Qisqacha nazariy ma’lumot
Piezoelement "chayqaluvchi" Piezo buzzer strukturaviy ravishda o‘tkazgichli keramika bilan qoplangan metall plastinka bilan ifodalanadi. Plastinka aloqa vazifasini bajaradi. Qurilma qutblangan, o‘zining "+" va "-" belgilariga ega. Buzzer printsipi XIX asr oxirida aka -uka Kyuri tomonidan topilgan piezoelektrik effektga asoslangan. Uning so‘zlariga ko‘ra, zilga elektr energiyasi berilsa, u deformatsiyalana boshlaydi. Bunday holda, kerakli chastotadagi "shovqin" chiqaradigan metall plastinkaga zarbalar bo‘ladi. Amaliy qism: Topshiriq kod qismi: #define ACTIVATED LOW //here the ACTIVATED word used for internal pull_up resistor when the button pressed it compare with this and if it is LOW BUZZER BUZZERS const int PIEZO = 3; const int BUTTON_A =5 ; const int BUTTON_B =6 ; const int BUTTON_C =8; const int BUTTON_D =9 ; const int BUTTON_E =10 ; const int BUTTON_F =11 ; const int led1 = 13; const int led2 = 12; const int led3 = 7; const int led4 = 4; const int led5 = 2; const int led6 = 1; void setup() { pinMode(PIEZO,OUTPUT); pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); pinMode(led4, OUTPUT); pinMode(led5, OUTPUT); pinMode(led6, OUTPUT); pinMode(BUTTON_A,INPUT); digitalWrite(BUTTON_A,HIGH); pinMode(BUTTON_B,INPUT); digitalWrite(BUTTON_B,HIGH); pinMode(BUTTON_C,INPUT); digitalWrite(BUTTON_C,HIGH); pinMode(BUTTON_D,INPUT); digitalWrite(BUTTON_D,HIGH); pinMode(BUTTON_E,INPUT); digitalWrite(BUTTON_E,HIGH); pinMode(BUTTON_F,INPUT); digitalWrite(BUTTON_F,HIGH); } void loop() { while(digitalRead(BUTTON_A) == ACTIVATED) { tone(PIEZO,380,500); if(digitalRead(BUTTON_A) == ACTIVATED){ digitalWrite(led6,HIGH); } else{ digitalWrite(led6,LOW); } } while(digitalRead(BUTTON_B) == ACTIVATED) { tone(PIEZO,420,500); if(digitalRead(BUTTON_B) == ACTIVATED){ digitalWrite(led5,HIGH); } else{ digitalWrite(led5,LOW); } } while(digitalRead(BUTTON_C) == ACTIVATED) { tone(PIEZO,490,500); if(digitalRead(BUTTON_C) == ACTIVATED){ digitalWrite(led4,HIGH); } else{ digitalWrite(led4,LOW); } } while(digitalRead(BUTTON_D) == ACTIVATED) { tone(PIEZO,530,500); if(digitalRead(BUTTON_D) == ACTIVATED){ digitalWrite(led3,HIGH); } else{ digitalWrite(led3,LOW); } } while(digitalRead(BUTTON_E) == ACTIVATED) { tone(PIEZO,590,500); if(digitalRead(BUTTON_E) == ACTIVATED){ digitalWrite(led2,HIGH); } else{ digitalWrite(led2,LOW); } } while(digitalRead(BUTTON_F) == ACTIVATED) { tone(PIEZO,620,500); if(digitalRead(BUTTON_F) == ACTIVATED){ digitalWrite(led1,HIGH); } else{ digitalWrite(led1,LOW); } } noTone(PIEZO); } Topshiriq linki: https://www.tinkercad.com/things/ltvftZHWbYq-2-piezoelement-orqali-jarayon-tashkil-etish/editel?sharecode=HzIV7Kx_NpZkjf0JsD66yd4JZrREPUL0wmYyx2JlRkU Xulosa Bu amaliy ishni bajarish orqali shuni o’rgandimki biz shift registirlari orqali pinlarni ko’paytirib kattaroq proyektlarni yasasak bo’ladi ekan. Yana Piezoelement nima ekanligi va u + va – ma’lumot qabul qilishi unda ovozlar bilan ishlashimiz mumkin ekanligini o’rgandim. Download 0.8 Mb. Do'stlaringiz bilan baham: |
1 2
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling