Aqilli shahar tarmoqlari va tizimlari


Download 1.3 Mb.
Sana07.11.2023
Hajmi1.3 Mb.
#1753552
Bog'liq
6-7-8



O’ZBEKISTON RESPUBLIKASI RAQAMLI TEXNOLOGIYALAR VAZIRLIGI
MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI SAMARQAND FILIALI



TELEKOMMUNIKATSIYA TEXNOLOGIYALARI VA KASB TA’LIMI FAKULTETI
AQILLI SHAHAR TARMOQLARI VA TIZIMLARI” fanidan
3-amaliy mashg’ulot


Bajaruvchi: Turayev N
Tekshiruvchi: Bolbekov M

Samarqand-2023


6-AMALIY ISH



void setup()
{
pinMode(A0, INPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
Serial.begin(9600);
}

void loop()
{
int x = analogRead(A0);
Serial.println(x);
delay(100);
if(x<100) {
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
} else if(x<500) {
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
} else if(x<800) {
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
} else {
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
}
}


7-AMALIY ISH



int distance = 0;

long readUltrasonicDistance (int trig, int echo)


{

pinMode (5, OUTPUT);

digitalWrite (5, LOW);

delayMicroseconds (2);

digitalWrite (5, HIGH);

delayMicroseconds (10);

digitalWrite (5, LOW);

pinMode (4, INPUT);

return pulseIn (4, HIGH);

}

void setup ()



{

pinMode (2, OUTPUT);

pinMode (3, OUTPUT);

pinMode (A0, INPUT);

pinMode (4, OUTPUT);
pinMode (5, OUTPUT);

pinMode (6, OUTPUT);


}

void loop ()

{

if (-40+0.488155*(analogRead(A0)-20)>0)



{

digitalWrite (2, HIGH);

digitalWrite (3, LOW);

} else


{

digitalWrite (3, HIGH);

digitalWrite (2, LOW);

}

{



distance = 0.01723 * readUltrasonicDistance (5, 4);

if (distance >100) noTone (6);

else

tone (6, 1000);



delay (100);}

}

8-AMALIY ISH






int temperatura = 0;
int gas;
int buzzer = 13;

void setup()
{
pinMode(A0, INPUT);
pinMode(buzzer, OUTPUT);
Serial.begin(9600);

pinMode(A1, INPUT);
Serial.begin(9600);

}

void loop()
{
temperatura = -160 + 0.488155 * (analogRead(A1) -22);
Serial.print("la temperatura es =");
Serial.print(temperatura);
Serial.println(" C");
delay(10);
gas = analogRead(A0);
if (gas >= 400 ){
tone (buzzer, 654, 100);
Serial.print("Valor de humo: ");
Serial.println(gas);
delay(400);
}
}
Download 1.3 Mb.

Do'stlaringiz bilan baham:




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