AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI MUSO AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI
O’rnatilgan tizimlar fanidan
AMALIY ISH-2
Bajardi: Nasulloyev Zuxriddin
Tekshirdi: Xasanov Umidjon
TOSHKENT – 2021
1. Smayliklar, Harakat chiroqlari, turli led lampalar yordamida shakllar hosil qilish
Ishdan maqsad:
Arduino orqali potonsiometr yordamida smayliklar, harakat chiroqlari, turli led lampalar yordamida shakllar hosil qilishni prinsipini o’rganish.
Kerakli jihozlar:Arduino Uno R3,resistor,svetodiod,maketnaya plata,kabellar,potonsiometr.
Ishni bajarish tartibi:
Hamma narsalarni ulab sxemani yig’ib olamiz.
Sxema yig’ilgan holat
Sxema ishlash jarayonidan lavhalar
Dastur kodi:
int potPin = A5;
int led1Pin = 2;
int led2Pin = 3;
int led3Pin = 4;
int led4Pin = 5;
void setup ()
{
pinMode (potPin, INPUT);
pinMode (led1Pin, OUTPUT);
pinMode (led2Pin, OUTPUT);
pinMode (led3Pin, OUTPUT);
pinMode (led4Pin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
int potMeasure = analogRead(A5);
Serial.println(potMeasure);
if (potMeasure < 256)
{
digitalWrite(led1Pin, HIGH);
digitalWrite(led2Pin, LOW);
digitalWrite(led3Pin, LOW);
digitalWrite(led4Pin, LOW);
}
else if(potMeasure < 512)
{
digitalWrite(led1Pin, HIGH);
digitalWrite(led2Pin, HIGH);
digitalWrite(led3Pin, LOW);
digitalWrite(led4Pin, LOW);
}
else if(potMeasure < 768)
{
digitalWrite(led1Pin, HIGH);
digitalWrite(led2Pin, HIGH);
digitalWrite(led3Pin, HIGH);
digitalWrite(led4Pin, LOW);
}
else if(potMeasure < 1024)
{
digitalWrite(led1Pin, HIGH);
digitalWrite(led2Pin, HIGH);
digitalWrite(led3Pin, HIGH);
digitalWrite(led4Pin, HIGH);
}
}
Linki: https://www.tinkercad.com/things/lm4Ckphs2Z9-fabulous-leelo/editel?sharecode=VswutqjTV6e-l3zCR4SIju5z4n1HBgaAYRBx-wC9-C0
Xulosa :
Men bugungi laboratoriya ishida potensiometr va led lampalar orqali smaylik yasashni o’rgandim.
Do'stlaringiz bilan baham: |