- Ulanish sxemasidan foydalanish
- Dasturdan foydalanish
Rasmda ko'rinishidan bir xil lekin, ishlash prinsipi 2 xil bo'lgan displey ko'rsatilgan.
- Birinchi turdagi displey 128x64 o'lchamdagi KS0108.
- Ikkinchi turdagi displey 128x64 o'lchamdagi ST7920.
KS0108 displeyning Arduino Uno qurilmasiga ulanishi:
ST7920 displeyning Arduino Uno qurilmasiga ulanishi:
#Arduino code
#include <Arduino.h>
#include <ArduinoJson.h>
#include <TimerOne.h>
DynamicJsonDocument doc(1024);
// ***********************************************************************************************************
// ** Agar 1 - turdagi displeydan [KS0108] foydalanilsa U8GLIB_H oldidan {//} belgini olib tashlash **
// ** aks holda 2 - turdagi displeydan [ST7920] foydalanilsa U8G2LIB_H oldidan [//] belgi olib tashlash **
// ** kerak bo'ladi **
// ***********************************************************************************************************
//#define U8GLIB_H
//#define U8G2LIB_H
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
#ifdef U8G2LIB_H
#include <U8g2lib.h>
U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* CS=*/ 10, /* reset=*/ 8);
#endif
#ifdef U8GLIB_H
#include <U8glib.h>
U8GLIB_KS0108_128 u8g(3, 4, 5, 6, 7, 8, 9, 10, 2, 11, 12, A2, A1); // 8Bit Com: DB0..DB7: 3,4,5,6,7,8,9,10, en=2, cs1=11, cs2=12,di=A2,rw=A1 || wiring 12864a display uchun
#endif