MultiLCD - a library for displaying texts on different LCD/OLED

Recently I developed a library for ease the job of displaying texts and numbers on different LCD/OLED modules. This is mainly for my OBD-II data logger project which can be made up of different sets of Arduino hardware. I named the library as Arduino Text Display Library for Multiple LCD, or short as MultiLCD.

The source code is available on Github.

The library encapsulates several libraries for various Arduino LCD/LED display shields or modules into a set of unified APIs.

Currently it supports these hardware:

DFRobot LCD4884 shield
Nokia 3310/5100 LCD module
LCD1602 shield
SSD1306 OLED module
ZT I2C OLED module

The library includes fonts data for ASCII characters (5×7) and digits (8×8, 16×16). By using the library, it is extremely simple for display texts and numbers on desired position on a LCD screen, while very little change is needed to switch from one LCD module to another.

The library class inherits the Print class of Arduino, so that you can display texts on LCD with standard Arduino functions like this:

lcd.print("Hello, World!";)
lcd.print(foo, DEC);
lcd.print(bar, HEX);
lcd.print(1.23)         // gives "1.23" 
lcd.print(1.23456, 2);  // gives "1.23"

Besides, it provides unified APIs for initializing and controlling the LCD, as well as some convenient operations.

void begin(); /* initializing */
void clear(); /* clear screen */
void setCursor(unsigned char column, unsigned char line); /* set current cursor */
void printInt(unsigned int n, FONT_SIZE size); /* display a integer number with desired size of font*/
void printLong(unsigned long n, FONT_SIZE size); /* display a long number with desired size of font*/

The code using the library can be extremely simple.

#include <Wire.h>
#include <MultiLCD.h>

LCD_SSD1306 lcd; /* for SSD1306 OLED module */

void setup()
{
    lcd.begin();
    lcd.clear();

    lcd.setCursor(0, 0);
    lcd.print("Hello, world!");

    lcd.setCursor(0, 1);
    lcd.printLong(1234567890, FONT_SIZE_SMALL);

    lcd.setCursor(0, 2);
    lcd.printLong(1234567890, FONT_SIZE_MEDIUM);

    lcd.setCursor(0, 3);
    lcd.printLong(12345678, FONT_SIZE_LARGE);
}

Hi,
Thank you for sharing this. It is great and exactly what I was looking for.
Any chance you can share the schematics of how to actually wire the multiple LCD to the arduino?

I am a complete newbie, so will appreciate any help and guidance.

Thanks

Hi Stanley,
Thanks for sharing this. It is looks like a great addition for LCD/OLED - particularly for displaying variables.

I have installed the libraries and tried the example. Unfortunately it did not work for me, but I assume it how I have the OLD connected differently to what the library expects .

In my current working system using the SSD1306 library, I have the following code to define the connections:

#define OLED_DC 11
#define OLED_CS 12
#define OLED_CLK 10
#define OLED_MOSI 9
#define OLED_RESET 13

#include <SSD1306.h>

SSD1306 oled(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

I assume that there is an "expected" connection standard with the MultiLCD library?

What are the expected OLED pins connections for the library?

Thank you

Andrew

Wondering if you could work into the library a font for a seven segment display or number that print out to be 2x or 3x (32x50pixels) the size of the XLARGE font, such as the one from the UTFT library?