1.8-rasm. Qurilmani ulash jarayoni.
Ulash pinlari 13-6 oralig’da. Qizil ledlar toq pinlarga (13, 11,…) yashil ledlar juft pinlarga ( 12, 10,… ) ulangan. Ledning kalta oyoqchasini GND piniga ulanadi va dastur kodini yozib ishga tushiriladi.
1.9-rasm. Qurilmani ishlash jarayoni.
Dastur kodi:
void setup()
{
pinMode(13, OUTPUT); // Breadbord dagi 1-ledni pin 13 ga ulash
pinMode(11, OUTPUT); // Breadbord dagi 2-ledni pin 13 ga ulash
pinMode(9, OUTPUT); // Breadbord dagi 3-ledni pin 13 ga ulash
pinMode(7, OUTPUT); // Breadbord dagi 4-ledni pin 13 ga ulash
pinMode(12, OUTPUT); // Breadbord dagi 5-ledni pin 13 ga ulash
pinMode(10, OUTPUT); // Breadbord dagi 6-ledni pin 13 ga ulash
}
void loop()
{
digitalWrite(13, HIGH);
delay(200); // 200 millisekun yonib turishini kutish
digitalWrite(13, LOW);
delay(200); // 200 millisekun LOW holatini kutish
digitalWrite(11, HIGH);
delay(200); // 200 millisekun yonib turishini kutish
digitalWrite(11, LOW);
delay(200); // 200 millisekun LOW holatini kutish
digitalWrite(9, HIGH);
delay(200); // 200 millisekun yonib turishini kutish
digitalWrite(9, LOW);
delay(200); // 200 millisekun LOW holatini kutish
digitalWrite(12, HIGH);
delay(200); // 200 millisekun yonib turishini kutish
digitalWrite(12, LOW);
delay(200); // 200 millisekun LOW holatini kutish
digitalWrite(10, HIGH);
delay(200); // 200 millisekun yonib turishini kutish)
digitalWrite(10, LOW);
delay(200); // 200 millisekun LOW holatini kutish
delay(200); // 200 millisekun LOW holatini kutish
delay(200); // 200 millisekun LOW holatini kutish
}
Do'stlaringiz bilan baham: |