#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
Adafruit_SSD1306 display (SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
int j = 1;
void setup () {
display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);
display.clearDisplay();
display.setTextSize(1);
}
void loop() {
j = !j;
for (int i = 0; i < SCREEN_HEIGHT; i += 2) {
display.setTextColor(WHITE);
if (j)
display.setCursor(0, i); // scroll UP
else
display.setCursor(0, SCREEN_HEIGHT - i); // scroll DOWN
display.println(F("Twas brillig, and theslithy toves Did gyre\nand gimble in th wabe\nAll mimsy were the\nborogoves, And the\nmome raths outgrabe."));
display.display();
display.clearDisplay();
}
}