const int greenLedPin = 9; // Yashil chiroqning pin raqami
const int redLedPin = 10; // Qizil chiroqning pin raqami
const int button1Pin = 2; // Birinchi knopkaning pin raqami
const int button2Pin = 3; // Ikkinchi knopkaning pin raqami
void setup() {
pinMode(greenLedPin, OUTPUT); // Yashil chiroqni chiqish sifatida sozlash
pinMode(redLedPin, OUTPUT); // Qizil chiroqni chiqish sifatida sozlash
pinMode(button1Pin, INPUT); // Birinchi knopkani kirish sifatida sozlash
pinMode(button2Pin, INPUT); // Ikkinchi knopkani kirish sifatida sozlash
}
void loop() {
// Birinchi knopkani tekshirish
if (digitalRead(button1Pin) == HIGH) {
digitalWrite(greenLedPin, HIGH); // Yashil chiroqni yonsin
} else {
digitalWrite(greenLedPin, LOW); // Yashil chiroqni o'chirsin
}
// Ikkinchi knopkani tekshirish
if (digitalRead(button2Pin) == HIGH) {
digitalWrite(redLedPin, HIGH); // Qizil chiroqni yonsin
} else {
digitalWrite(redLedPin, LOW); // Qizil chiroqni o'chirsin
}
}