Rgb yorug‘lim diodi bilan ishlash. Impuls kengligining modulyatsiyasi


Download 1.08 Mb.
bet8/12
Sana25.10.2023
Hajmi1.08 Mb.
#1720270
1   ...   4   5   6   7   8   9   10   11   12
Bog'liq
jsT AXAF5MQ0s1GPm rgNWenOTK5n3nB

Arduino bog‘lash:
USB kabellari yordamida Arduino-ni kompyuterga bog‘lang.
Arduino IDE dasturini oching (agaro‘rnatsa).
Qurilmani bog‘lash:
Arduino bilan 4-razryadli 7-segmentli indikatorni ulash uchun quyidagi shaklda ulanishingiz kerak:
7 segment LED displeyning HT16K33 mikrokontrolleri bilan bog‘liq bo‘lgan backpackni ulash uchun, Adafruit 7-segment LED backpack kutubxonasi yokio‘xshash birini ishlatishingiz mumkin. Bu kutubxonalarda HT16K33 mikrokontrollerio‘rnatilgan va uningga I2C interfeys orqali ulanishingiz mumkin.
Bu kutubxonalarda dastur ishlatish uchun quyidagi qadamlarni bajarishingiz kerak:


Kerakli jihozlar:

  • Arduino (masalan, Arduino Uno)

  • 7-segment LED backpack (Adafruit backpack yokio‘xshash)

  • Jumper kabellari

  • Arduino va 7-segment LED backpack ulash:

  • 7-segment LED backpackni Arduinoga ulash uchun quyidagi tartibni amalga oshiring:

  • VCC pinini Arduino 5V tegiga ulang.

  • GND pinini Arduino GND (yer osti) bilan ulang.

  • SDA pinini Arduino A4 piniga ulang (I2C Data Line).

  • SCL pinini Arduino A5 piniga ulang (I2C Clock Line).

Dastur yozish:
Dastur yozish uchun Adafruit neopixel kutubxonasining bibliotekasinio‘rnatishingiz kerak. Bu biblioteka Adafruit kutubxonalaridan foydalanish uchun kerak bo‘ladi. Arduino IDE dasturida, "Sketch" menysidan "Include Library" ni tanlang, keyin "Manage Libraries"ni tanlang, va "Adafruit HT16K33" yokio‘xshash kutubxona nomini qidirib toping vao‘rnatib oling.

31-rasm. Ulanish sxemasi
Dastur tuzish:
Quyidagi dastur orqali Arduino bilan 7 segment LED backpackni boshqarish mumkin:
#include
#include
#include


Adafruit_7segment matrix = Adafruit_7segment();


void setup() {
Wire.begin(); // I2C busni boshlaymiz
matrix.begin(0x70); // Backpack manba adresi
}


void loop() {
for (int i = 0; i <= 9999; i++) {
matrix.print(i);
matrix.writeDisplay();
delay(1000);
}
}
Ushbu dasturda 0x70 manba adresi, 7-segment LED backpackni manba adresini anglatadi. Ushbu manba adresini backpackning orqasidagi kukuni yoki qo‘shimcha dokumentatsiyanio‘qib chiqishingiz mumkin.
Ushbu dastur orqali 7 segment LED backpack orqali 1 dan 9999 gacha sonlarni namoyish etishni sinab ko‘rish mumkin.


714-20-guruh o’quvchisi Fayziyev Samandar.



Download 1.08 Mb.

Do'stlaringiz bilan baham:
1   ...   4   5   6   7   8   9   10   11   12




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling