#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);
void setup() {
// put your setup code here, to run once:
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
display.clearDisplay();
display.setTextSize(1); // Set text size
display.setTextColor(SSD1306_WHITE); // Set text color to white
display.setTextWrap(false); // Disable text wrapping
}
void loop() {
// put your main code here, to run repeatedly:
String message = "Be the calm river, flowing steadily towards the ocean of your becoming. Don't chastise yourself for the bends and currents. ";
int textWidth = message.length() * 6; // Approx width of each character for text size 1
for(int x = SCREEN_WIDTH; x > -textWidth; x--) {
display.clearDisplay();
display.setCursor(x, 28); // Set cursor position
display.print(message);
display.display();
delay(5); // Speed of the text movement
}
}