// Library for OLED Display
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED width, in pixels
#define SCREEN_HEIGHT 64 // OLED height, in pixels
// create an OLED display object connected to I2C
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
int kode;
void setup() {
Serial.begin(9600);
kode=1;
// initialize OLED display with I2C address 0x3C
if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("failed to start SSD1306 OLED"));
while (1);
}
delay(2000);
oled.clearDisplay();
oled.setTextSize(1);
oled.setTextColor(WHITE);
oled.setCursor(0, 2);
oled.println("switch case");
oled.display();
}
void loop() {
oled.setTextSize(1);
oled.setTextColor(WHITE);
oled.setCursor(0, 12);
//switch case
switch (kode){
case 1:
oled.print("january");
//break;
case 2:
oled.print("february");
//break;
case 3:
oled.print("march");
break;
case 4:
oled.print("april");
break;
case 5:
oled.print("may");
break;
default:
oled.print("wrong case");
}
oled.display();
delay(1000);
}