Bilet №31 Oddiy o‘rnatilgan tizimlar nimalar kiradi?


Arduino IDE orqali svetodiodlar yordamida svetofor dasturini tuzing. Ranglar almashinish intervalini 5 sekund deb belgilang


Download 32.47 Kb.
bet15/15
Sana20.06.2023
Hajmi32.47 Kb.
#1629312
1   ...   7   8   9   10   11   12   13   14   15
Bog'liq
biletlar

Arduino IDE orqali svetodiodlar yordamida svetofor dasturini tuzing. Ranglar almashinish intervalini 5 sekund deb belgilang
const int redLED = 10;
const int yellowLED = 9;
const int greenLED = 8;
void setup() {
pinMode(redLED, OUTPUT);
pinMode(yellowLED, OUTPUT);
pinMode(greenLED, OUTPUT);
}
void loop() {
digitalWrite(redLED, HIGH); // Qizil yorug'lik yonaydi
digitalWrite(yellowLED, LOW); // Sariq yorug'lik yo'q
digitalWrite(greenLED, LOW); // Yashil yorug'lik yo'q
delay(5000); // 5 sekund kutamiz
// Sariq svetofor
digitalWrite(redLED, LOW); // Qizil yorug'lik yo'q
digitalWrite(yellowLED, HIGH); // Sariq yorug'lik yonaydi
digitalWrite(greenLED, LOW); // Yashil yorug'lik yo'q
delay(5000); // 5 sekund kutamiz
// Yashil svetofor
digitalWrite(redLED, LOW); // Qizil yorug'lik yo'q
digitalWrite(yellowLED, LOW); // Sariq yorug'lik yo'q
digitalWrite(greenLED, HIGH); // Yashil yorug'lik yonaydi
delay(5000); // 5 sekund kutamiz
}



Download 32.47 Kb.

Do'stlaringiz bilan baham:
1   ...   7   8   9   10   11   12   13   14   15




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