Smooth scrolling text library for the SSD1306 display / Arduino. With this library you can display a horizontal scrolling textline on your SSD1306 display. The scrolling text will appear either on top or bottom of your display. There is no restriction about the length of the textline, this is especially useful for displaying live messages such as feeds or measurement data.
I've written this library for the Wemos LOLIN32 board, which uses an ESP32 with a SSD1306 OLED display.
For a live view, see https://youtu.be/L9V65wh85Yk
You have to use a monospaced Font. I have provided one font with one size, but you can generate more fonts with an online generator: http://oleddisplay.squix.ch/
Just include the JLInfoTicker.h
in your arduino library path
JLInfoTicker.h
filetick()
function periodically, typically in between the loop()
function.
void init(SSD1306Wire *oled,const uint8_t *fontData, InfoTickerCallback cb )
void setScrollDelay(int sdelay)
(in ms, default 25ms)int getScrollDelay()
void setBottomAligned(bool ba)
(true=>bottom, false=top, default bottom)bool isBottomAligned()
void tick()
The callback function for providing your text has following signature: typedef String (* InfoTickerCallback)(int);
This function will be called every time a new text is required, this can be initially or if a previous text was fully scrolled. The incoming parameter is an incrementing counter value which you can use for your logic to return your desired text,
for example: periodically alternating 4 textlines:
String abc[]={"Text line AAA", "Text line BBB","Text line CCC,"Text line DDD"};
infoTicker.init(& display,Monospaced_plain_12,[](int nr){int n=nr%4;return abc[n];});
See the file InfoTickerTest.ino
in the examples folder.