#include <Adafruit_SSD1306.h> // Or Adafruit_SSD1351.h for SPI
#define SCREEN_WIDTH 128 // Adjust for your display size
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire); // I2C
// Or Adafruit_SSD1351 display(SCREEN_WIDTH, SCREEN_HEIGHT, CS_PIN, DC_PIN, MOSI_PIN, SCLK_PIN, RST_PIN); // SPI
String text = "asd";
int textPosition = -text.length() * 6 * 3; // Start off-screen to the left
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // I2C, adjust address if needed
// Or display.begin(); // SPI
display.clearDisplay();
}
void loop() {
display.clearDisplay();
display.setTextSize(3);
display.setTextColor(WHITE);
display.setCursor(textPosition, 1);
display.println(text);
display.display();
textPosition++; // Move text to the right
if (textPosition > SCREEN_WIDTH) {
textPosition = -text.length() * 6 * 3; // Reposition to the left
}
delay(100); // Adjust delay for desired scrolling speed
}