Extension to LiquidCryrstal library with builtin (also float) printf support!

I needed printf support for my double digits for my LCD without exhausting too much memory. As the standards library solutions neither String did not fit into my board, I wrote my own library to extend standard LiquidCrystal library with necessary enhancments.

The main enhancements are:

  • built-in printf support, including floats (does not require memory expensive String library).
  • support uppercase and lowercase command for strings stored in PROGMEM.
  • PROGMEM support for createChar bitmaps (saves memory)
  • static PROGMEM string array support;
  • center command to print text into the center of the screen
  • one line command to display the text at specific position display(0,1,F("Hello Word"));
  • similarly one line command for displayf(pos, line, text, ...);
  • scroll PROGMEM strings in screen (works also on subsection of LCD screen) (in order to enable, refresh screen every 200 milliseconds with the scroll(strng array) command.

All LiquidCrystal commands are working as well, as this library extends standard library. (I however needed to change "void command(uint8_t value);" function from private to public in LiquidCrystal library.)

Usage examples:

 	#include "myLCD.h"
  	myLCD lcd(7,8,6,5,4,3); // define lcd
  	// define PROGMEM strings
  	static const prog_char VESSEL_S[] PROGMEM = "Masina";
  	static const prog_char CONFIGURATION[] PROGMEM = "seadistamine";

       // define non-standard characters
static const byte bell[8] PROGMEM
= { B00100, B01110, B01110, B01110, B01110, B11111, B00000, B00100 };  //! bell symbol
  	void setup(){
  		lcd.begin(16, 2);
                lcd.createChar(1, bell); // bell should be in PROGMEM in order to work
  		lcd.display(0, 0, F("Hello")); // helper function, which merges lcd.setCursor and lcd.print 
  		lcd.display(0, 1, F("Word!"));
  		lcd.display(10, 1, 3.1415926,2);
  		lcd.center(0, F("Hello")); // helper function, prints into center of LCD
  		lcd.display(0, 0, VESSEL_S); // uses static const defined before
  		lcd.display(0, 1, CONFIGURATION);
  		lcd.display(0, 0, (upper)VESSEL_S); // converts PROGMEM text to UPPERCASE "MASINA"
  		lcd.display(0, 1, (lower)VESSEL_S); // converts PROGMEM text to lowercase "masina"
  		lcd.printf(F("Nr %5.1f"), 3.1415926); // displays floating number trough printf command
  		char ht = 'f';
  		char pp = 'c';
  		// more ellaborate printf command (displays from second pos in the second row)
  		lcd.displayf(1, 1, PSTR("%01i:%02i:%02i %c%c %*.*f"), 0, 2, 30, ht, pp, 4, 1, 16.4533));

   void loop {
       lcd.scroll(4, 0, CONFIGURATION, 8); 

Library is downloadable from:

An interesting implementation.

Pity you didn't see my PrintEx library in the library manager, it allows printf, streaming (in/out) and many more features with any Stream/Print object. Although mine does not have specific functions like center (can be done in printf and padding though).

Anyway, your code looks good (but still has one function using the String library).

Nice work