Project: OLED Display using Adafruit SSD1306

Tugus Ibram
21 min readFeb 27, 2021

A II2260 Project!

Welcome to my blog! Back again with me, Tugus

Hari ini aku lagi gak mood pake bahasa inggris karena mikirnya dua kali.. Jadi hari ini aku pakai Bahasa Indonesia deh hehehe.

Ngapain sih?

Oke jadi, hari ini aku bakalan ngeblog tentang project aku di Sistem Embedded yaitu bermain-main dengan ESP32. Kali ini temanya aku bakal menggunakan OLED Display Output dari Adafruit, namanya Adafruit SSD1306. Ukuran layarnya sih sebenernya kecil, cuma 0.96 inch dan dia tuh cuma 128 x 64 pixel. Bandingin aja sama HP ku yang 2400 x 1080.. jauh ya hahahaha.

Butuh apa aja?

Oke jadi untuk project ini, kita butuh:

  1. ESP32
  2. Jumper Cable Male to Male sebanyak 4 buah
  3. OLED display
  4. Laptop
  5. Arduino IDE

Tapi kita sebenernya mau ngapain sih?? Tiba tiba udah bahan aja?

Bener juga ya, hehe. OKE OKE MAAP

Jadi di project ini tuh kita bakal bermain-main dengan grafis, mulai dari mengetes displaynya dengan berbagai macam gambar bergerak, hingga membuat gambar custom buatan sendiri!

Nah untuk bisa mulai, kita butuh external libraries nih, nah untungnya di randomnerdtutorials, udah dijelasin tuh bahwa kita butuh beberapa libraries:Adafruit_SSD1306 library dan Adafruit_GFX library.

Cara installnya gampang banget, jadi kita hanya perlu pergi ke

Sketch -> Include Libraries ->Manage Libraries -> Search ‘SSD1306’, trus install deh! Sama juga buat yang GFX libraries ya, jangan sampai lupa!

Adafruit SSD1306 library
Adafruit GFX Library

Setelah itu selesai, yuk kita rangkai!

Schematicnya gimana??

Nih skemanya, sebenernya aku nyomot dari randomnerdtutorials sih HEHEHE

Jadi bisa kalian lihat di OLED kalian, kita cuma butuh 4 pin nih, 3V, Ground, SDA dan SCL. Hati hati ketuker ya antara SDA dan SCL, ntar gabisa nyala dia. #belajardaripengalaman

Oke jadi kalo udah di susun tuh kayak begini gais:

Begini rangkaiannya

Nah kalau udah, kita coba testing pake kode yang tersedia di File -> Examples -> Adafruit SSD1306 -> ssd1306_128x64_i2c. Kodenya harusnya kayak begini:

/*********
Complete project details at https://randomnerdtutorials.com

This is an example for our Monochrome OLEDs based on SSD1306 drivers. Pick one up today in the adafruit shop! ------> http://www.adafruit.com/category/63_98
This example is for a 128x64 pixel display using I2C to communicate 3 pins are required to interface (two I2C and one reset).
Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries, with contributions from the open source community. BSD license, check license.txt for more information All text above, and the splash screen below must be included in any redistribution.
*********/

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#define NUMFLAKES 10 // Number of snowflakes in the animation example

#define LOGO_HEIGHT 16
#define LOGO_WIDTH 16
static const unsigned char PROGMEM logo_bmp[] =
{ B00000000, B11000000,
B00000001, B11000000,
B00000001, B11000000,
B00000011, B11100000,
B11110011, B11100000,
B11111110, B11111000,
B01111110, B11111111,
B00110011, B10011111,
B00011111, B11111100,
B00001101, B01110000,
B00011011, B10100000,
B00111111, B11100000,
B00111111, B11110000,
B01111100, B11110000,
B01110000, B01110000,
B00000000, B00110000 };

void setup() {
Serial.begin(115200);

// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}

// Show initial display buffer contents on the screen --
// the library initializes this with an Adafruit splash screen.
display.display();
delay(2000); // Pause for 2 seconds

// Clear the buffer
display.clearDisplay();

// Draw a single pixel in white
display.drawPixel(10, 10, WHITE);

// Show the display buffer on the screen. You MUST call display() after
// drawing commands to make them visible on screen!
display.display();
delay(2000);
// display.display() is NOT necessary after every single drawing command,
// unless that's what you want...rather, you can batch up a bunch of
// drawing operations and then update the screen all at once by calling
// display.display(). These examples demonstrate both approaches...

testdrawline(); // Draw many lines

testdrawrect(); // Draw rectangles (outlines)

testfillrect(); // Draw rectangles (filled)

testdrawcircle(); // Draw circles (outlines)

testfillcircle(); // Draw circles (filled)

testdrawroundrect(); // Draw rounded rectangles (outlines)

testfillroundrect(); // Draw rounded rectangles (filled)

testdrawtriangle(); // Draw triangles (outlines)

testfilltriangle(); // Draw triangles (filled)

testdrawchar(); // Draw characters of the default font

testdrawstyles(); // Draw 'stylized' characters

testscrolltext(); // Draw scrolling text

testdrawbitmap(); // Draw a small bitmap image

// Invert and restore display, pausing in-between
display.invertDisplay(true);
delay(1000);
display.invertDisplay(false);
delay(1000);

testanimate(logo_bmp, LOGO_WIDTH, LOGO_HEIGHT); // Animate bitmaps
}

void loop() {
}

void testdrawline() {
int16_t i;

display.clearDisplay(); // Clear display buffer

for(i=0; i<display.width(); i+=4) {
display.drawLine(0, 0, i, display.height()-1, WHITE);
display.display(); // Update screen with each newly-drawn line
delay(1);
}
for(i=0; i<display.height(); i+=4) {
display.drawLine(0, 0, display.width()-1, i, WHITE);
display.display();
delay(1);
}
delay(250);

display.clearDisplay();

for(i=0; i<display.width(); i+=4) {
display.drawLine(0, display.height()-1, i, 0, WHITE);
display.display();
delay(1);
}
for(i=display.height()-1; i>=0; i-=4) {
display.drawLine(0, display.height()-1, display.width()-1, i, WHITE);
display.display();
delay(1);
}
delay(250);

display.clearDisplay();

for(i=display.width()-1; i>=0; i-=4) {
display.drawLine(display.width()-1, display.height()-1, i, 0, WHITE);
display.display();
delay(1);
}
for(i=display.height()-1; i>=0; i-=4) {
display.drawLine(display.width()-1, display.height()-1, 0, i, WHITE);
display.display();
delay(1);
}
delay(250);

display.clearDisplay();

for(i=0; i<display.height(); i+=4) {
display.drawLine(display.width()-1, 0, 0, i, WHITE);
display.display();
delay(1);
}
for(i=0; i<display.width(); i+=4) {
display.drawLine(display.width()-1, 0, i, display.height()-1, WHITE);
display.display();
delay(1);
}

delay(2000); // Pause for 2 seconds
}

void testdrawrect(void) {
display.clearDisplay();

for(int16_t i=0; i<display.height()/2; i+=2) {
display.drawRect(i, i, display.width()-2*i, display.height()-2*i, WHITE);
display.display(); // Update screen with each newly-drawn rectangle
delay(1);
}

delay(2000);
}

void testfillrect(void) {
display.clearDisplay();

for(int16_t i=0; i<display.height()/2; i+=3) {
// The INVERSE color is used so rectangles alternate white/black
display.fillRect(i, i, display.width()-i*2, display.height()-i*2, INVERSE);
display.display(); // Update screen with each newly-drawn rectangle
delay(1);
}

delay(2000);
}

void testdrawcircle(void) {
display.clearDisplay();

for(int16_t i=0; i<max(display.width(),display.height())/2; i+=2) {
display.drawCircle(display.width()/2, display.height()/2, i, WHITE);
display.display();
delay(1);
}

delay(2000);
}

void testfillcircle(void) {
display.clearDisplay();

for(int16_t i=max(display.width(),display.height())/2; i>0; i-=3) {
// The INVERSE color is used so circles alternate white/black
display.fillCircle(display.width() / 2, display.height() / 2, i, INVERSE);
display.display(); // Update screen with each newly-drawn circle
delay(1);
}

delay(2000);
}

void testdrawroundrect(void) {
display.clearDisplay();

for(int16_t i=0; i<display.height()/2-2; i+=2) {
display.drawRoundRect(i, i, display.width()-2*i, display.height()-2*i,
display.height()/4, WHITE);
display.display();
delay(1);
}

delay(2000);
}

void testfillroundrect(void) {
display.clearDisplay();

for(int16_t i=0; i<display.height()/2-2; i+=2) {
// The INVERSE color is used so round-rects alternate white/black
display.fillRoundRect(i, i, display.width()-2*i, display.height()-2*i,
display.height()/4, INVERSE);
display.display();
delay(1);
}

delay(2000);
}

void testdrawtriangle(void) {
display.clearDisplay();

for(int16_t i=0; i<max(display.width(),display.height())/2; i+=5) {
display.drawTriangle(
display.width()/2 , display.height()/2-i,
display.width()/2-i, display.height()/2+i,
display.width()/2+i, display.height()/2+i, WHITE);
display.display();
delay(1);
}

delay(2000);
}

void testfilltriangle(void) {
display.clearDisplay();

for(int16_t i=max(display.width(),display.height())/2; i>0; i-=5) {
// The INVERSE color is used so triangles alternate white/black
display.fillTriangle(
display.width()/2 , display.height()/2-i,
display.width()/2-i, display.height()/2+i,
display.width()/2+i, display.height()/2+i, INVERSE);
display.display();
delay(1);
}

delay(2000);
}

void testdrawchar(void) {
display.clearDisplay();

display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(WHITE); // Draw white text
display.setCursor(0, 0); // Start at top-left corner
display.cp437(true); // Use full 256 char 'Code Page 437' font

// Not all the characters will fit on the display. This is normal.
// Library will draw what it can and the rest will be clipped.
for(int16_t i=0; i<256; i++) {
if(i == '\n') display.write(' ');
else display.write(i);
}

display.display();
delay(2000);
}

void testdrawstyles(void) {
display.clearDisplay();

display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(WHITE); // Draw white text
display.setCursor(0,0); // Start at top-left corner
display.println(F("Hello, world!"));

display.setTextColor(BLACK, WHITE); // Draw 'inverse' text
display.println(3.141592);

display.setTextSize(2); // Draw 2X-scale text
display.setTextColor(WHITE);
display.print(F("0x")); display.println(0xDEADBEEF, HEX);

display.display();
delay(2000);
}

void testscrolltext(void) {
display.clearDisplay();

display.setTextSize(2); // Draw 2X-scale text
display.setTextColor(WHITE);
display.setCursor(10, 0);
display.println(F("scroll"));
display.display(); // Show initial text
delay(100);

// Scroll in various directions, pausing in-between:
display.startscrollright(0x00, 0x0F);
delay(2000);
display.stopscroll();
delay(1000);
display.startscrollleft(0x00, 0x0F);
delay(2000);
display.stopscroll();
delay(1000);
display.startscrolldiagright(0x00, 0x07);
delay(2000);
display.startscrolldiagleft(0x00, 0x07);
delay(2000);
display.stopscroll();
delay(1000);
}

void testdrawbitmap(void) {
display.clearDisplay();

display.drawBitmap(
(display.width() - LOGO_WIDTH ) / 2,
(display.height() - LOGO_HEIGHT) / 2,
logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
display.display();
delay(1000);
}

#define XPOS 0 // Indexes into the 'icons' array in function below
#define YPOS 1
#define DELTAY 2

void testanimate(const uint8_t *bitmap, uint8_t w, uint8_t h) {
int8_t f, icons[NUMFLAKES][3];

// Initialize 'snowflake' positions
for(f=0; f< NUMFLAKES; f++) {
icons[f][XPOS] = random(1 - LOGO_WIDTH, display.width());
icons[f][YPOS] = -LOGO_HEIGHT;
icons[f][DELTAY] = random(1, 6);
Serial.print(F("x: "));
Serial.print(icons[f][XPOS], DEC);
Serial.print(F(" y: "));
Serial.print(icons[f][YPOS], DEC);
Serial.print(F(" dy: "));
Serial.println(icons[f][DELTAY], DEC);
}

for(;;) { // Loop forever...
display.clearDisplay(); // Clear the display buffer

// Draw each snowflake:
for(f=0; f< NUMFLAKES; f++) {
display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, WHITE);
}

display.display(); // Show the display buffer on the screen
delay(200); // Pause for 1/10 second

// Then update coordinates of each flake...
for(f=0; f< NUMFLAKES; f++) {
icons[f][YPOS] += icons[f][DELTAY];
// If snowflake is off the bottom of the screen...
if (icons[f][YPOS] >= display.height()) {
// Reinitialize to a random position, just off the top
icons[f][XPOS] = random(1 - LOGO_WIDTH, display.width());
icons[f][YPOS] = -LOGO_HEIGHT;
icons[f][DELTAY] = random(1, 6);
}
}
}
}

Well, kode diatas emang ribet dibaca, tapi coba aja deh kalian run, keren gitu HAHAHA, kek gini penampakkannya

video timelapse

Kalau kita lihat kodenya, ada banyak banget yang bisa dilakukan sama SSD1306 ini. Sebagai contoh, kita bisa nih bikin OLED kita menampilkan ‘Hello World’ di displaynya dengan kode ini:

/*********
Rui Santos
Complete project details at https://randomnerdtutorials.com
*********/

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

void setup() {
Serial.begin(115200);

if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
delay(2000);
display.clearDisplay();

display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 10);
// Display static text
display.println("Hello, world!");
display.display();
}

void loop() {
}

Bisa kita lihat, di setup terdapat kode

if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}

Ini berguna untuk memeriksa apakah display kita sudah valid atau belum di alamat tersebut. Pada device ku, alokasi OLEDnya sudah benar

Beberapa command yang bisa kita lakukan di OLED display ini diantara lainnya adalah display.clearDisplay() untuk membersihkan layar, display.setTextSize(x) untuk mengatur ukuran tulisan sebesar x, untuk menulis tulisan dapat menggunakan display.println(args) display.setTextColor(color) untuk mengatur warna tulisan, dan display.display() untuk menampilkan grafis yang telah kita susun. Selain itu, kita juga bisa menentukan posisi dimana tulisan/gambar dicetak dengan display.setCursor(x,y) untuk mengatur koordinat, dari (0,0) hingga (128,64)

gambar hello world

ISENG NGAPAIN YAH??

Jadi akhir-akhir ini aku lagi suka baca, nonton, dan searching-searching tentang Star Wars, lagi. Nah jadi karena OLED aku itu warnanya biru muda, jadi aku keinget openingnya Star Wars yang A long time ago in a galaxy far, far away .... gitu, jadi aku kepikiran utk ngebuat itu deh di OLED, beserta logo starwars biar kayak opening star wars gitu!!

Jadi berdasarkan di sini , kita bisa mengubah sebuah gambar menjadi sebuah bit code gitu, sehingga gambarnya yang awalnya format .jpeg berubah menjadi format bit map, dan bit map tersebut bisa di convert ke bit code sehingga nanti setiap bit nya ada sebuah nilai hexadecimal yang merepresentasikan warna, dengan 0x00 warna hitam, dan 0xFF itu warna putih. Kita bisa langsung generate bit codenya lewat website https://javl.github.io/image2cpp/ . Tapi jangan lupa untuk mengubah canvas size nya menjadi 128 x 64, karena OLED display yang kita miliki berukuran kecil. Contohnya jadi begini

static const uint8_t image_data_sw[960] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x22, 0x48, 0x02, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

Nah pas nyoba, aku dapet banyak kendala. Tiba-tiba pas aku upload, jadinya kaya gini

Hancur gitu… sedih :( Ternyata setelah aku selidiki, itu karena gambarnya tuh gak muat, jadi ya akhirnya aku terpaksa cari gambar lain, dan aku nemunya helm darth vader. Jadi aku pake itu, dan aku susun kodenya begini:

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
const unsigned char myBitmap [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xe7, 0xf7, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3f, 0xfc, 0x00, 0x07, 0xf0, 0x00, 0x1f, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xff, 0x80, 0x0f, 0x87, 0xf0, 0x00, 0x01, 0xff, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xfc, 0x00, 0x03, 0xc7, 0xf0, 0x00, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0xc7, 0xf0, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x47, 0xf0, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1f, 0xc0, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x01, 0xf8, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0x80, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x01, 0x9f, 0x80, 0x00, 0x00,
0x00, 0x00, 0x01, 0xfc, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x01, 0x9f, 0x80, 0x00, 0x00,
0x00, 0x00, 0x01, 0xf8, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x03, 0xcf, 0x80, 0x00, 0x00,
0x00, 0x00, 0x01, 0xf8, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x0f, 0xcf, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x01, 0xf8, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x3f, 0xcf, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x01, 0xf8, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x01, 0xf8, 0xff, 0xfc, 0x00, 0x07, 0xf0, 0x00, 0x07, 0xfe, 0x0f, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xfc, 0x07, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x03, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x03, 0xf0, 0x3f, 0xfe, 0x00, 0xff, 0xff, 0xc0, 0x3f, 0xfe, 0x0f, 0xe0, 0x00, 0x00,
0x00, 0x00, 0x07, 0xe1, 0xff, 0xff, 0xfc, 0x07, 0xf0, 0x1f, 0xff, 0xff, 0x87, 0xe0, 0x00, 0x00,
0x00, 0x00, 0x0f, 0xe3, 0xff, 0xff, 0xff, 0xe0, 0x03, 0xff, 0xff, 0xff, 0xe3, 0xf0, 0x00, 0x00,
0x00, 0x00, 0x0f, 0xc7, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xe3, 0xf0, 0x00, 0x00,
0x00, 0x00, 0x1f, 0xc7, 0xf0, 0x00, 0x1f, 0xff, 0x7f, 0xfc, 0x00, 0x07, 0xe1, 0xf8, 0x00, 0x00,
0x00, 0x00, 0x1f, 0x87, 0xf0, 0x00, 0x03, 0xfc, 0x3f, 0xc0, 0x00, 0x0f, 0xe0, 0xf8, 0x00, 0x00,
0x00, 0x00, 0x3f, 0x83, 0xf8, 0x00, 0x07, 0xf8, 0x9f, 0xe0, 0x00, 0x0f, 0xe0, 0xfc, 0x00, 0x00,
0x00, 0x00, 0x3f, 0x03, 0xfc, 0x00, 0x0f, 0xf1, 0xc7, 0xf0, 0x00, 0x1f, 0xe0, 0x7c, 0x00, 0x00,
0x00, 0x00, 0x7e, 0x07, 0xfe, 0x00, 0x3f, 0xe7, 0xe3, 0xfc, 0x00, 0x7f, 0xf0, 0x7e, 0x00, 0x00,
0x00, 0x00, 0x7e, 0x0f, 0xff, 0xff, 0xff, 0xcf, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0x3f, 0x00, 0x00,
0x00, 0x00, 0xfc, 0x0f, 0xff, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0x00, 0x00,
0x00, 0x00, 0xfc, 0x1f, 0xdf, 0xff, 0xf8, 0x3e, 0x1e, 0x0f, 0xff, 0xff, 0xf8, 0x1f, 0x80, 0x00,
0x00, 0x01, 0xf8, 0x1f, 0xc0, 0x00, 0x00, 0x7c, 0x1f, 0x00, 0x00, 0x01, 0xfc, 0x1f, 0x80, 0x00,
0x00, 0x03, 0xf8, 0x3f, 0x80, 0x00, 0x01, 0xfc, 0x1f, 0x80, 0x00, 0x00, 0xfc, 0x0f, 0xc0, 0x00,
0x00, 0x03, 0xf0, 0x3f, 0xc0, 0x00, 0x03, 0xff, 0xff, 0xc0, 0x00, 0x01, 0xfe, 0x07, 0xc0, 0x00,
0x00, 0x07, 0xe0, 0x7f, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xe0, 0x00, 0x1f, 0xff, 0x07, 0xe0, 0x00,
0x00, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xcf, 0xfd, 0xdf, 0xf1, 0xff, 0xff, 0xff, 0x03, 0xf0, 0x00,
0x00, 0x1f, 0xc0, 0xff, 0xff, 0xff, 0x9f, 0xf1, 0xcf, 0xfc, 0xff, 0xff, 0xff, 0x83, 0xf8, 0x00,
0x00, 0x1f, 0x81, 0xf0, 0xff, 0xc0, 0x3f, 0xe1, 0xc7, 0xfe, 0x7f, 0xff, 0x8f, 0x81, 0xf8, 0x00,
0x00, 0x3f, 0x01, 0x80, 0x3f, 0xe0, 0xff, 0xe1, 0xc7, 0xff, 0x03, 0xfe, 0x01, 0xc0, 0xfc, 0x00,
0x00, 0x7e, 0x00, 0x00, 0x0f, 0xf9, 0xff, 0xe1, 0xc7, 0xff, 0x8f, 0xf8, 0x00, 0x20, 0x7e, 0x00,
0x00, 0xfc, 0x00, 0x00, 0x03, 0xf3, 0xff, 0x61, 0xc7, 0xff, 0xcf, 0xe0, 0x00, 0x00, 0x3f, 0x00,
0x01, 0xfc, 0x00, 0x00, 0x00, 0xe7, 0xfc, 0x61, 0xc7, 0x3f, 0xe3, 0xc0, 0x00, 0x00, 0x3f, 0x80,
0x03, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xf8, 0x61, 0xc7, 0x1f, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xc0,
0x07, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0x61, 0xc7, 0x0f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xc0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xe0, 0xe1, 0xc7, 0x07, 0xfe, 0x0f, 0xff, 0xfc, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xc0, 0xf1, 0xc7, 0x03, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1e, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1c, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char myBitmap2 [] 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, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x18, 0x08, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xc0, 0x03, 0xff, 0xf8, 0x0f, 0xff, 0xe0, 0x03, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x00, 0x7f, 0xf0, 0x78, 0x0f, 0xff, 0xfe, 0x00, 0x7f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xfc, 0x03, 0xff, 0xfc, 0x38, 0x0f, 0xff, 0xff, 0xc0, 0x3f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0x38, 0x0f, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xb8, 0x0f, 0xff, 0xff, 0xfc, 0x07, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xfe, 0x07, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xc0, 0x7f, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0x60, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xfe, 0x60, 0x7f, 0xff, 0xff,
0xff, 0xff, 0xfe, 0x03, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xfe, 0x60, 0x7f, 0xff, 0xff,
0xff, 0xff, 0xfe, 0x07, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xfc, 0x30, 0x7f, 0xff, 0xff,
0xff, 0xff, 0xfe, 0x07, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xf0, 0x30, 0x3f, 0xff, 0xff,
0xff, 0xff, 0xfe, 0x07, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xc0, 0x30, 0x3f, 0xff, 0xff,
0xff, 0xff, 0xfe, 0x07, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff,
0xff, 0xff, 0xfe, 0x07, 0x00, 0x03, 0xff, 0xf8, 0x0f, 0xff, 0xf8, 0x01, 0xf0, 0x3f, 0xff, 0xff,
0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x03, 0xf8, 0x0f, 0xf0, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff,
0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff,
0xff, 0xff, 0xfc, 0x03, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x01, 0xff, 0xff, 0x80, 0x3f, 0xff, 0xff,
0xff, 0xff, 0xfc, 0x0f, 0xc0, 0x01, 0xff, 0x00, 0x00, 0x3f, 0xc0, 0x01, 0xf0, 0x1f, 0xff, 0xff,
0xff, 0xff, 0xf8, 0x1e, 0x00, 0x00, 0x03, 0xf8, 0x0f, 0xe0, 0x00, 0x00, 0x78, 0x1f, 0xff, 0xff,
0xff, 0xff, 0xf0, 0x1c, 0x00, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x00, 0x00, 0x1c, 0x0f, 0xff, 0xff,
0xff, 0xff, 0xf0, 0x38, 0x0f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x1c, 0x0f, 0xff, 0xff,
0xff, 0xff, 0xe0, 0x38, 0x0f, 0xff, 0xe0, 0x00, 0x80, 0x03, 0xff, 0xf8, 0x1e, 0x07, 0xff, 0xff,
0xff, 0xff, 0xe0, 0x78, 0x0f, 0xff, 0xfc, 0x03, 0xc0, 0x3f, 0xff, 0xf0, 0x1f, 0x07, 0xff, 0xff,
0xff, 0xff, 0xc0, 0x7c, 0x07, 0xff, 0xf8, 0x07, 0x60, 0x1f, 0xff, 0xf0, 0x1f, 0x03, 0xff, 0xff,
0xff, 0xff, 0xc0, 0xfc, 0x03, 0xff, 0xf0, 0x0e, 0x38, 0x0f, 0xff, 0xe0, 0x1f, 0x83, 0xff, 0xff,
0xff, 0xff, 0x81, 0xf8, 0x01, 0xff, 0xc0, 0x18, 0x1c, 0x03, 0xff, 0x80, 0x0f, 0x81, 0xff, 0xff,
0xff, 0xff, 0x81, 0xf0, 0x00, 0x00, 0x00, 0x30, 0x0e, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0xff, 0xff,
0xff, 0xff, 0x03, 0xf0, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x07, 0xc0, 0xff, 0xff,
0xff, 0xff, 0x03, 0xe0, 0x20, 0x00, 0x07, 0xc1, 0xe1, 0xf0, 0x00, 0x00, 0x07, 0xe0, 0x7f, 0xff,
0xff, 0xfe, 0x07, 0xe0, 0x3f, 0xff, 0xff, 0x83, 0xe0, 0xff, 0xff, 0xfe, 0x03, 0xe0, 0x7f, 0xff,
0xff, 0xfc, 0x07, 0xc0, 0x7f, 0xff, 0xfe, 0x03, 0xe0, 0x7f, 0xff, 0xff, 0x03, 0xf0, 0x3f, 0xff,
0xff, 0xfc, 0x0f, 0xc0, 0x3f, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xfe, 0x01, 0xf8, 0x3f, 0xff,
0xff, 0xf8, 0x1f, 0x80, 0x00, 0x00, 0x18, 0x00, 0x00, 0x1f, 0xff, 0xe0, 0x00, 0xf8, 0x1f, 0xff,
0xff, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x30, 0x02, 0x20, 0x0e, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0xff,
0xff, 0xe0, 0x3f, 0x00, 0x00, 0x00, 0x60, 0x0e, 0x30, 0x03, 0x00, 0x00, 0x00, 0x7c, 0x07, 0xff,
0xff, 0xe0, 0x7e, 0x0f, 0x00, 0x3f, 0xc0, 0x1e, 0x38, 0x01, 0x80, 0x00, 0x70, 0x7e, 0x07, 0xff,
0xff, 0xc0, 0xfe, 0x7f, 0xc0, 0x1f, 0x00, 0x1e, 0x38, 0x00, 0xfc, 0x01, 0xfe, 0x3f, 0x03, 0xff,
0xff, 0x81, 0xff, 0xff, 0xf0, 0x06, 0x00, 0x1e, 0x38, 0x00, 0x70, 0x07, 0xff, 0xdf, 0x81, 0xff,
0xff, 0x03, 0xff, 0xff, 0xfc, 0x0c, 0x00, 0x9e, 0x38, 0x00, 0x30, 0x1f, 0xff, 0xff, 0xc0, 0xff,
0xfe, 0x03, 0xff, 0xff, 0xff, 0x18, 0x03, 0x9e, 0x38, 0xc0, 0x1c, 0x3f, 0xff, 0xff, 0xc0, 0x7f,
0xfc, 0x00, 0x00, 0x00, 0x00, 0x30, 0x07, 0x9e, 0x38, 0xe0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x3f,
0xf8, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x9e, 0x38, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x3f,
0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x1f, 0x1e, 0x38, 0xf8, 0x01, 0xf0, 0x00, 0x03, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x3f, 0x0e, 0x38, 0xfc, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe1, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe3, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x01, 0xe3, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xf0, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x03, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1f, 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
};
void setup() {
Serial.begin(115200);

if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
delay(2000); // Pause for 2 seconds

// Clear the buffer.
display.clearDisplay();
//draw it!
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,28);
display.println("A long time ago, in a galaxy far, far away....");
display.display();
delay(3000);
display.clearDisplay();
display.drawBitmap(0,0,myBitmap, 128,64,1);
display.display();
}
void loop() {}

Dan, outputnya jadi begini gais:

KEREN KAN HAHAHA

Basically pertama untuk tulisan ‘A long time ago..’ itu cuma pakai display.println() aja, abis itu untuk gambar, aku pake genrator yang diatas.

Analisis

Banyak kendala yang aku alamin disini.

  1. Display gak nyala:(

Waktu itu sempet displaynya gak mau nyala, berkali2 aku upload juga gak mau nyala. Ternyata, kabelnya agak longgar, pas aku benerin, langsung bener hehehehe

2. OLED menampilkan gambar yang gak jelas

Nah pas gambarnya rusak, aku udah curiga dari awal bahwa pasti ini masalah ukuran layarnya, dan emang bener, gambar yg di generate dari website generator nya tuh terlalu besar, jadi displaynya cuma bisa nampilin sebagian kecil gitu

3. Kode example gak jalan

Aku masih gatau ini kenapa, cuman kalo aku copas kodenya dari randomnerd langsung, malah jalan. Ini masih aku selidiki karena codenya panjang gitu.

Ya jadi, kesimpulannya adalah wiring itu penting, dan coba banyakin eksplorasi dii kodenya ya!

--

--