Optimallashtirish fanidan tayyorlagan


Download 456.01 Kb.
Sana19.06.2023
Hajmi456.01 Kb.
#1626876
Bog'liq
Modellashtirish mustaqil (1) (2)


Farg’ona Politexnika instituti KLT fakulteti IMT kafedrasi TJBAKT 69-20 guruh talabasi Nizomov Nurmuhammad Texnologik jarayonlarni modellashtirish va
optimallashtirish fanidan tayyorlagan
Mustaqil ish
Ovoz Sirenasi modeli
1 ta Arduino Uno R3, 1 tadan Havorang va Qizil svetodiod
1ta 1kmOm Rezistor, 1 ta Boshqarish uchun tugma,
1 ta Ovoz chiqarish uchun Pezoelement
Ushbu modelda tugma bosilgan paytda qurilmadan politsiya sirenasi ovozi chiqadi va diodlar ham unga mos o’chib yonadi. Thinker Cad orqali ushbu model yaratildi va unga C++ dasturlash tilida ovoz va diod ochib yonishi uchun maxsus kod yozildi
int pulsador = 0;
int estado = 0;
int pulsador_anterior = 0;
void setup()
{
pinMode(8, INPUT);
Serial.begin(9600);
pinMode(A0, OUTPUT);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
}
void loop()
{
pulsador = digitalRead(8);
if (pulsador == 1 && pulsador_anterior == 0) {
estado = (1 - estado);
delay(40); // Wait for 40 millisecond(s)
Serial.println(estado);
}
pulsador_anterior = pulsador;
if (estado == 1) {
tone(A0, 746, 1000); // play tone 60 (C5 = 523 Hz)
digitalWrite(13, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
tone(A0, 700, 1000); // play tone 60 (C5 = 523 Hz)
digitalWrite(12, HIGH);
digitalWrite(13, LOW);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(12, LOW);
} else {
digitalWrite(13, LOW);
digitalWrite(12, LOW);
noTone(A0);
}
}
Download 456.01 Kb.

Do'stlaringiz bilan baham:




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