|
Potensiometr. Arduino orqali yorug‘lik diodini yorug‘lik darajasini o‘zgartirishini namoyish etish. Potensiometrni xarakatlantirish orqali yonayotgan yorug‘lik diodining sonini o‘zgartirish (Arduinoda)
|
bet | 3/3 | Sana | 12.01.2024 | Hajmi | 1,03 Mb. | | #135770 |
Bog'liq 3-mavzuIsh ketma ketligi:
Arduino qurilmamizni quvvatga ulab olamiz
5V pinini Patensiometrning 1-uchiga ulaymiz
GND pinini Patensiometrning 3-uchiga ulaymiz
Patensiometrning 2-pinini resistorga ulaymiz
Resistorning boshqa uchuni Ledning musbat tomoniga ulaymiz
Led ning manfiy tomonini GNDga ulaymiz
Potensiometrni burab ko'ramiz
Ledning yorug'ligi o'zgarsa, biz maqsadga erishdik(o'xshamasa commentga yozing)
2- rasm. Patensiometr va LED ning bog’lanish sxemasi
Ikkinchi tajriba
Maqsad: Analog pin orqali malumot qabul qilish va kompyuterga yuborish.
Buning uchun kerak:
Arduino qurilmasi
Jumper(kabellar)
Potensiometr(Potensiometr)
Breadboard.
Ish ketma ketligi:
Arduino qurilmamizni quvvatga ulab olamiz
5V pinini Patensiometrning 1-uchiga ulaymiz
GND pinini Patensiometrning 3-uchiga ulaymiz
Patensiometrning 2-pinini Arduinoning A0 piniiga ulaymiz
CODE yozamiz
3- rasm. Patensiometrning ARDUINO bilan bo’lanishi
void setup{
Serial.begin(9600);
}
void loop{
Serial.print(analogRead(A0));
Serail.print("\n");
delay(100);
}
Serial.begin(9600) => bu Arduino qurilmamiz bilan axborot almashish uchun yo'l(tunel) ochadi.
Serial.print() => print funksiyasi orqali kompyuterga malumot yuborishingiz mumkin.
analogRead(A0) => bu A0 pindan kelayotgan malumotlarni beradi.
\n => pastki qatorga tushadi.
delay(100) => 100ms kutadi.
Bu codeni Arduino qurilmamizga o'rnatganimizdan so'ng Tools bo'limidan Serial monitor ni bosamiz va 9600 ni tanlaymiz chunki biz 9600 yozgan edik. Patensiometrning xolaatiga qarab bizga yuborilayotgan malumot o’zgaradi
4- rasm. Malumot qabul qilib olish oynasi
5- rasm. Yorug’likni o’zgarishi sxemasi
Dastur:
int adcValue;
int ledPin = 9;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
adcValue = analogRead(A0);
analogWrite(ledPin, map(adcValue, 0, 1023, 0, 255));
}
6- rasm. 10 ta LED bilan yorug’lik diodini o’zgarishi sxemasi
Dastur kodi:
const int analogPin = A0;
const int ledCount = 10;
int ledPins[] = {
2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
void setup() {
for (int thisLed = 0; thisLed < ledCount; thisLed++) {
pinMode(ledPins[thisLed], OUTPUT);
} }
void loop() {
int sensorReading = analogRead(analogPin);
int ledLevel = map(sensorReading, 0, 1023, 0, ledCount);
for (int thisLed = 0; thisLed < ledCount; thisLed++) {
if (thisLed < ledLevel) {
digitalWrite(ledPins[thisLed], HIGH);
}
else {
digitalWrite(ledPins[thisLed], LOW);
} } }
Hisobot mazmuni.
Laboratoriya ishining hisobotida quyidagilar kеltirilishi shart:
1. Ishning maqsadi.
2. O’rganilayotgan laboratoriya ishidan tushuncha.
3. Sxemalar ko’rinishlarini word dasturida electron shaklda tayyorlash.
4. Berilgan topshiriqlar bo’yicha yig’ilgan sxemalar.
5. Nazorat savollari.
1. Patensiometr nima uchun qo’llaniladi?
2. Potensiometr qanday tuzilishga ega?
3.Patensiometrni qanday turlarini bilasiz?
3. Patensiometrni qayerlarda qo’llash mumkin?
|
|
Bosh sahifa
Aloqalar
Bosh sahifa
Potensiometr. Arduino orqali yorug‘lik diodini yorug‘lik darajasini o‘zgartirishini namoyish etish. Potensiometrni xarakatlantirish orqali yonayotgan yorug‘lik diodining sonini o‘zgartirish (Arduinoda)
|