Oldindan ko'rish bo'limi - O`rnatilgan tizimlar

Oldindan ko'rish bo'limi
Oldindan ko'rish bo'limida biz quyida ko'rsatilgandek OLED-da ko'rsatiladigan tasvirning aniq ko'rinishini ko'rishimiz mumkin:
Chiqish bo'limi
Chiqish qismida biz yaratilgan kodni yaratamiz va nusxalaymiz, buning uchun quyidagi amallarni bajaring:
Kodni chiqarish formati (biz uni Arduino kodi sifatida o'rnatdik, chunki biz ulardan foydalanamiz).
Identifikator (bu parametr yaratilgan massiv nomini belgilaydi, biz uni asl holicha qoldiramiz).
Chizish rejimi (Biz chizish rejimini gorizontal holatga o'rnatdik).
Va nihoyat, biz kod yaratish tugmasini bosamiz, bu yakuniy chiqish kodini yaratadi.
Quyidagi rasm sizga aniq fikr beradi
Elektr sxemasi
Quyidagi rasmda Arduino Nano va SSD1306 o'rtasidagi interfeys ulanishlari ko'rsatilgan :
Arduino Nano Pin
|
OLED PIN-kod
|
GND
|
GND
|
3,3 V
|
VCC
|
D13
|
CLK
|
D11
|
MOSI
|
D8
|
RES
|
D9
|
SDC
|
D10
|
CCS
|
Kod tushuntirish
OLED-da tasvirni ko'rsatish uchun bizga ushbu GitHub omboridan yuklab olish mumkin bo'lgan Arduino kutubxonasi yordami kerak . Kutubxonaning U8glib-1.19.1.zip versiyasini yuklab oling va uni Arduino IDE-ga import qiling. Agar siz Arduino-da yangi bo'lsangiz , kutubxonani qanday import qilishni tavsiflovchi ushbu havoladan foydalaning . Quyidagi bo'limda biz kodni oldindan yaratilgan HEX massivini OLED-ga ko'rsatish uchun o'zgartiramiz. Ishchi video bilan to'liq kod ushbu maqolaning oxirida berilgan. Kodning batafsil tushuntirishi quyida keltirilgan.
Birinchidan, yuklab olingan kutubxonani qo'shing.
#include "U8glib.h" // U8glib kutubxonasini o'z ichiga oladi
Keyin OLED uchun barcha kerakli pinlarni aniqlang.
#OLED_CLK_PIN 13-ni aniqlang //Arduino Digital Pin D13: SCK #OLED_MOSI_PIN 11-ni aniqlang //Arduino Digital Pin D11: MOSI #OLED_RES_PIN 10 ni aniqlang //Arduino Digital Pin D10: SS #OLED_SDC_PIN 9-ni aniqlang //Arduino Digital Pin D9: OC1A #OLED_CSS_PIN 8-ni aniqlang //Arduino Digital Pin D13: ICP1
u8glib kutubxonasini ishga tushiring.
U8GLIB_SH1106_128X64 u8g(OLED_CLK_PIN, OLED_MOSI_PIN, OLED_RES_PIN, OLED_SDC_PIN, OLED_CSS_PIN);
Keyin yaratilgan tasvirlar qatorini qo'shing.
const uint8_t circuitdigest[] PROGMEM = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x1c, 0x01, 0x87, 0xf0, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x0c, 0x01, 0x87, 0xf0, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0x8f, 0xf0, 0x7f, 0x31, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0x8f, 0xf0, 0x7f, 0x33, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x81, 0x8f, 0x31, 0x80, 0x33, 0x81, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x01, 0x8f, 0x31, 0x80, 0x33, 0x81, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x01, 0x8f, 0xb1, 0x80, 0x33, 0x81, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x01, 0x8f, 0xc1, 0x98, 0x33, 0x81, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x01, 0x8f, 0xc1, 0x98, 0x33, 0x81, 0xcf, 0xff, 0xff, 0xff, 0xff, …….. ………..
Draw funksiyasi u8g.drawBitmapP funksiyasi yordamida OLED-da bitmap tasvirini (QR kod) chizish uchun ishlatiladi.
bekor chizish (void) { // to'liq ekranni qayta chizish uchun grafik buyruqlar bu erda joylashtirilishi kerak u8g.drawBitmapP( 0, 0, 16, 64, sxema bo'yicha); ….. ……
Nihoyat, loop() funksiyasida OLED-da tasvirni yaratish uchun barcha kerakli protseduralarni chaqiring
void loop() { u8g.firstPage(); //Ushbu protseduraga qo'ng'iroq, rasm tsiklining boshlanishini belgilaydi. qil { chizish(); } while( u8g.nextPage() ); // Ushbu protseduraga qo'ng'iroq, rasm tsikli tanasining oxirini belgilaydi. // biroz kechikishdan keyin rasmni qayta tiklang kechikish (1000);}
Kodni to'ldirgandan so'ng, Arduino-ni kompyuteringizning USB portiga ulang, COM portingizni tanlang va kodni yuklang. Agar siz hamma narsani to'g'ri bajargan bo'lsangiz, siz OLED-da QR kodli ishlaydigan displeyga ega bo'lasiz.
Umid qilamanki, siz ushbu loyihani yoqtirdingiz va yangi narsalarni o'rganishni yoqtirdingiz, o'qishni davom eting va keyingi safar sizni ko'raman.
Dastur kod ko`rinishi
Foydalanilgan adabiyotlar:
1.https://www.arduino.cc/reference/en/libraries/qrcode/
2.https://wokwi.com/projects/318641692720759379
3.https://circuitdigest.com/microcontroller-projects/arduino-qr-code-generator
4.https://www.hackster.io/Hack-star-Arduino/arduino-simulator-qr-code-generation-on-arduino-ssd1306-786044
5.https://forum.arduino.cc/t/encoding-and-generating-qr-codes/292774
Xulosa
Bizga berilgan topshiriq orqali QR kod dasturini ishlab chiqdik va qanday ishlashini ko’rib chiqdik.QR kodini o’rganish kodlash jarayonini urganib o’tdik .
Raqamli qulayliklar davrida QR kod generatori PDF axborot almashishni tez, samarali va tejamkor qiladigan juda qimmatli vositadir. Ammo QR kod generatorlarining keng doirasini hisobga olsak, tegishli vositani tanlash juda qiyin bo'lishi mumkin. QR kod generatorini tanlashda e'tiborga olish kerak bo'lgan asosiy omillarga foydalanish qulayligi, narxlash, sozlash imkoniyatlari va mijozlarni qo'llab-quvvatlash kiradi.
|