Getting-an-sh1122-256-x-64-7-pin-oled-working

Original LInks

For those who are new this LCD, SPI etc. may I post my updates (and for my future self). The old link above work but sort of miss minor details. Easy to figure it out. But just in case someone like me who is newbie, this might help (or not).

// See https://forum.arduino.cc/t/assistance-on-getting-an-sh1122-256-x-64-7-pin-oled-working/1118847 for the code
// See library manager to install Ug82lib i.e. 
//     first read https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries/
//     and then see https://www.arduino.cc/reference/en/libraries/u8g2/)
// double check /Users/<users>/Documents/Arduino/libraries/U8g2/src/clib/u8g2.h 
//      #define U8G2_16BIT // already defined defined in the latest version 2.34.22

// it works

#include <SPI.h>

#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>

/*
Board
Nano    OLED
Mega
-------------
GND     GND
5V      Vcc
A5(19)  SCL
A4(18)  SDA
13      RST
A3(17)  DC
A2(16)  CS

#define PIN_MOSI 18 // or data  i.e. SDA
#define PIN_CLK 19  // or clock i.e. SCK
#define PIN_DC 17
#define PIN_CS 16
#define PIN_RST 13

*/



U8G2_SH1122_256X64_2_4W_SW_SPI u8g2(U8G2_R0, 
  /* clock=*/ 19,  // 12,  SCL 
  /* data=*/ 18,   // 11,  SDA 
  /* cs=*/ 16,     // 9, 
  /* dc=*/ 17,     // 10, 
  /* reset=*/ 13); // 15);        // Enable U8G2_16BIT in u8g2.h



void setup(void) {
  u8g2.begin();
  u8g2.firstPage();
  do {
    u8g2.clearBuffer();
    u8g2.setFont(u8g2_font_ncenB08_tr);
    u8g2.drawStr(180, 20, "hello world 2");  // 0 left, 0 top bottom appx 100
  } while(u8g2.nextPage());
  delay(1000);
}

void loop() {
}

My board is for ulisp use, just a random chinese board saying on the back

ZJY_M2.08_7P
Pixels:256x64
Driver IC:SH1122
Interface: SPI(Default)/IIC

The front has the seven pin: GND, VCC, SCL, SDA, RES, DC, CS

Give this link a try: Interfacing 2.42 INCH OLED SPI/I2C Display Module with Arduino This was my second hit while using "ZJY_M2.08_7P" as my search term.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.