#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// Gambar kue ulang tahun (32x32 pixel)
const unsigned char cake [] PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,
0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,
0x00,0x42,0x00,0x42,0x00,0x00,0x00,0x00,
0x00,0x81,0x00,0x81,0x00,0x00,0x00,0x00,
0x7E,0xFF,0x7E,0xFF,0x7E,0x00,0x00,0x00,
0x42,0xA5,0x42,0xA5,0x42,0x00,0x00,0x00,
0x81,0x99,0x81,0x99,0x81,0x00,0x00,0x00,
0x7E,0xFF,0x7E,0xFF,0x7E,0x00,0x00,0x00,
0x00,0x7E,0x00,0x7E,0x00,0x00,0x00,0x00,
0x00,0x42,0x00,0x42,0x00,0x00,0x00,0x00,
0x00,0x3C,0x00,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
// Gambar love (32x32 pixel)
const unsigned char love [] PROGMEM = {
0x00,0x00,0x06,0x60,0x1F,0xF8,0x3F,0xFC,
0x7F,0xFE,0x7F,0xFE,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x7F,0xFE,0x3F,0xFC,
0x1F,0xF8,0x0F,0xF0,0x07,0xE0,0x03,0xC0,
0x01,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
};
void setup() {
Serial.begin(115200);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("OLED gagal ditemukan"));
for(;;);
}
display.clearDisplay();
// Tulis ucapan
display.setTextSize(1); // Ukuran huruf
display.setTextColor(WHITE);
display.setCursor(10, 0); // Posisi teks
display.println("Happy Birthday,");
display.setCursor(24, 10);
display.println("Mauliddin!");
// Gambar kue di kiri bawah
display.drawBitmap(0, 28, cake, 32, 32, WHITE);
// Gambar love di kanan bawah
display.drawBitmap(96, 28, love, 32, 32, WHITE);
display.display(); // Tampilkan semua
}
void loop() {
// Kosong karena hanya tampil statis
}