What is LcdProgressBar?
LcdProgressBar is an Arduino library for displaying a progress bar in LCD display.
Dependencies
The LCD display must be previously initialized. This library uses LiquidCrystal library for displaying.
Expected result
2 seconds progress bar, looping
Example
Refer to full example: examples/Timer/Timer.ino.
Includes
#include <LiquidCrystal.h>
#include <LcdProgressBar.h> //## Include this lib
Initialization: instantiations
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
LcdProgressBar lpg(&lcd, 1, 16);
Initializing the progress bar
void initLpg()
{
//-- start time
startedMillis = millis();
//-- Set min and max values
lpg.setMinValue(startedMillis);
lpg.setMaxValue(startedMillis + duration);
}
Drawing the progress bar
//-- draw progress bar
lpg.draw(currentMillis);
or via the alias drawValue (the LcdBarGraph way :wink:):
//-- draw progress bar
lpg.drawValue(currentMillis);
EXPANDED TECHNICAL DETAILS
Visual Progress Telemetry
LcdProgressBar provides a professional-grade graphical interface for tracking hardware processes, file uploads, or sensor calibration on standard character LCDs.
- Custom Character Definition: Standard LCDs (like the HD44780) only display text. This project uses the Arduino's
createChar()function to define 5-to-8 custom bitmaps, representing different "levels" of a single bar segment (e.g., 20%, 40%, 60% full). - Dynamic Mapping Algorithm: The firmware uses the
map()function to convert a raw process value (0-100) into a series of full and partial custom characters, creating a smooth, high-resolution visual progress bar.
UI Versatility
- Flicker-Free Updates: The code optimized the write-cycle; instead of clearing the whole LCD, it only overwrites the specific characters that have changed, ensuring a clean and stable display during fast-moving processes.