//Nama : Choirul Aminin
//NIM : 20102117
//Tugas : Menampilkan teks pada OLED
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define LEBAR_LAYAR 128 // Lebar layar OLED yang digunakan
#define TINGGI_LAYAR 64 // Lebar layar OLED yang digunakan
Adafruit_SSD1306 oled(LEBAR_LAYAR, TINGGI_LAYAR, &Wire, -1);
void setup(){
Serial.begin(9600);
//Inisialisasi OLED display with I2C address 0x3C
if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)){
Serial.println(F("failed to start "));
while (1);
}
delay(2000);
oled.clearDisplay(); //menghapus tampilan
oled.setTextSize(1); //mengatur ukuran text
oled.setTextColor(WHITE); //mengatur warna text
oled.setCursor(0,10); // mengatur posisi text pada display
oled.println("Hello Kelas C"); //Text yang dicetak
oled.display(); //menampilkan display oled
}
void loop(){
}