#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Textliterale definieren
const char msg0[] = "bitte warten.";
const char msg1[] = "bitte eintreten.";
const char msg2[] = "bitte nicht stoeren.";
// Zeiger auf die Textliterale speichern
const char* const messages[] = {msg0,msg1,msg2};
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(115200);
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
display.display();
delay(1000); // Pause for 2 seconds
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(WHITE); // Draw white text
display.cp437(true);
// Clear the buffer
display.clearDisplay();
display.setCursor(1,1);
display.print(messages[0]);
display.display();
display.setCursor(1,10);
display.print(messages[1]);
display.display();
display.setCursor(1,20);
display.print(messages[2]);
display.display();
// Text über Zeiger ausgebee
Serial.println(messages[0]);
Serial.println(messages[1]);
Serial.println(messages[2]);
}
void loop() {
// put your main code here, to run repeatedly:
}