#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Wire.h>
// Ukuran OLED (128x64)
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
// Buat objek display
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
// Gambar sederhana: hati ❤️
static const unsigned char PROGMEM heart_bmp[] = {
0b00001100, 0b00110000,
0b00011110, 0b01111000,
0b00111111, 0b11111100,
0b01111111, 0b11111110,
0b01111111, 0b11111110,
0b00111111, 0b11111100,
0b00011111, 0b11111000,
0b00001111, 0b11110000,
0b00000111, 0b11100000,
0b00000011, 0b11000000,
0b00000001, 0b10000000,
0b00000000, 0b00000000
};
void setup() {
// Mulai OLED
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
for(;;); // Berhenti jika gagal
}
display.clearDisplay();
// Tampilkan teks
display.setTextSize(2);
display.setTextColor(SSD1306_WHITE);
display.setCursor(10,0);
display.println("Wokwik!");
display.setTextSize(1);
display.setCursor(15, 30);
display.println("Keep Smiling :)");
// Tampilkan gambar hati
display.drawBitmap(50, 45, heart_bmp, 16, 12, SSD1306_WHITE);
display.display();
}
void loop() {
// Bisa ditambah animasi kalau mau
}