O‘ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI
RIVOJLANTIRISH VAZIRLIGI MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI
“O‘rnatilgan tizimlar” fanidan
Laboratoriya mashg’uloti
Bajardi:831-19-gurux talabasi
Urolov Zarif
Qabul qildi: Begmatov Shoxrux
Toshkent 2022
2 - Laboratoriya mashg’uloti nomi:
Yorug’lik diodi. Arduino yordamida yorug’lik diodini o’chirib yoqish.
Topshiriq: 20 - variant
Led pin 8; On time 300; Off time 1500:
Ulanish sxemasi
Dastur kodi:
void setup()
{
pinMode(8, OUTPUT);
}
void loop()
{
digitalWrite(8, HIGH); delay(300); digitalWrite(8, LOW); delay(1500);
}
XULOSA
Men bu laboratoriya ishini bajarib ARDUINO, led lampochka, resistor haqida bir qancha bilimlarga ega bo’ldim. Arduino yordamida yorug’lik diodini o’chirib yoqishni o’rgandim va bir qancha nazariy savollarga javob topdim.
3 - LABORATORIYA MASHG‘ULOTI NOMI:
Tugma (Knopka). Yorug‘lik diodini yoqish misolida tugmaning bosilishiga ishlov berish. Titrashga qarshi kurashish.
20 – variant
Led pin 8; button pin 5:
ULANISH SXEMASI
DASTUR KODI
void setup()
{
pinMode(8, OUTPUT); pinMode(5, INPUT); digitalWrite(5, HIGH);
}
void loop()
{
int buttonState=digitalRead (5); if(buttonState==1){ digitalWrite(8, HIGH);
}else{
digitalWrite(8, LOW);
}
}
XULOSA
Men bu laboratoriya ishini bajarib Arduino yordamida yorug’lik diodini tugma yordamida o’chirib yoqishni o’rgandim va bir qancha nazariy savollarga javob topdim.
4 - LABORATORIYA MASHG‘ULOTI NOMI:
Potensiometr. Arduino orqali yorug‘lik diodini yorug‘lik darajasini o‘zgartirishini namoyish etish.
ULANISH SXEMASI
DASTUR KODI
int LED_PIN = 5;
void setup()
{
Serial.begin(9600);
pinMode(5, OUTPUT);
}
void loop()
{
int analogValue = analogRead(A5);
int brightness = map(analogValue, 286, 736, 199, 234);
analogWrite(5, brightness);
Serial.print("Analog:"); Serial.print(analogValue); Serial.print("Brightness:"); Serial.println(brightness); delay(100);
}
XULOSA
Men bu laboratoriya ishini bajarib Arduino yordamida yorug’lik diodini Potensiometr yordamida yorqinligini ozgartirishni o’rgandim va bir qancha nazariy savollarga javob topdim.
5-LABORATORIYA MASHG‘ULOTI NOMI:
Potensiometrni harakatlantirish orqali yonayotgan yorug‘lik diodining sonini o‘zgartirish.
ULANISH SXEMASI
DASTUR KODI:
#define LED_1_PIN 9
#define LED_2_PIN 11
#define LED_3_PIN 10
#define POTENTIOMETER_PIN A5
#define LED_NUMBER 3
void setup()
{
pinMode(LED_1_PIN, OUTPUT); pinMode(LED_2_PIN, OUTPUT); pinMode(LED_3_PIN, OUTPUT);
}
void loop()
{
int potentiometerValue = analogRead(POTENTIOMETER_PIN); int ledChoice = potentiometerValue/(1024/LED_NUMBER);
if(ledChoice>LED_NUMBER-1){ ledChoice=LED_NUMBER-1;
}
if(ledChoice==0){ digitalWrite(LED_1_PIN, HIGH); digitalWrite(LED_2_PIN, LOW); digitalWrite(LED_3_PIN, LOW);
}
else if(ledChoice==1){ digitalWrite(LED_1_PIN, LOW); digitalWrite(LED_2_PIN, HIGH); digitalWrite(LED_3_PIN, LOW);
}
else{
digitalWrite(LED_1_PIN, LOW); digitalWrite(LED_2_PIN, LOW); digitalWrite(LED_3_PIN, HIGH);
}
}
XULOSA
Men bu laboratoriya ishini bajarib Arduino yordamida bir nechta yorug’lik diodini parallel ravishda Potensiometr yordamida yorqinligini ozgartirishni o’rgandim va bir qancha nazariy savollarga javob topdim.
Do'stlaringiz bilan baham: |