Arduinoga ulanish sxemasi:
6-laboratoriya ishi knopka yordamida svetofor harakati boshqarish.
Kod qismi:
int button_pin = 2;
void setup()
{
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(button_pin, INPUT);
}
void loop()
{
digitalWrite(11, HIGH);
digitalWrite(12, LOW);
digitalWrite(13, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
delay(3000);
digitalWrite(11, LOW);
digitalWrite(12, HIGH);
digitalWrite(13, LOW);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
delay(1000);
digitalWrite(11, LOW);
digitalWrite(12, LOW);
digitalWrite(13, HIGH);
digitalWrite(10, LOW);
delay(3000);
}
Xulosa: Men bu laboratoriya ishida svetofor harakatini kuzatib va uni knopka yordamida harakatini o’zgartirib boshqardim.
Do'stlaringiz bilan baham: |