// Minimalis kode OLED
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define SCREEN_ADDRESS 0x3C
#define OLED_RESET -1
int x = 64;
int y = 32;
int dx =1;
int dy=1;
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);
display.clearDisplay();
}
void loop() {
// put your main code here, to run repeatedly:
display.drawPixel(x, y, WHITE);
display.display();
x=x+dx; y=y+dy;
if (x==0 || x==127) dx=-dx;
if (y==0 || y==63) dy=-dy;
display.clearDisplay();
}