LcdProgressBar

LcdProgressBar © GPL3+

LcdProgressBar displays a progress bar in LCD display.

  • 2,591 views
  • 0 comments
  • 7 respects

Components and supplies

Apps and online services

About this project

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);

Code

Timer.inoC/C++
Demo of LcdProgressBar library: progress bar for 2s, looping.
#include <LiquidCrystal.h>
#include <LcdProgressBar.h>

byte lcdNumCols = 16; // -- number of columns in the LCD

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
LcdProgressBar lpg(&lcd, 1, lcdNumCols);

unsigned long duration = 2000; // 2000 milliseconds, 2 seconds
unsigned long startedMillis  = 0;

void setup() {
  //-- Only useful for debugging purpose
  Serial.begin(9600);

  //-- initializing the LCD
  lcd.begin(2, lcdNumCols);
  lcd.clear();

  lcd.setCursor(0, 0);
  lcd.print("LcdProgressBar");
      
  delay(100);

  //-- initializing the progress bar
  initLpg();
}

//-- initializing the progress bar
void initLpg()
{
  //-- start time
  startedMillis = millis();

  //-- Set min and max values
  lpg.setMinValue(startedMillis);
  lpg.setMaxValue(startedMillis + duration);

  //-- Draw it: the frame
  lpg.draw(startedMillis);
}

void loop() {

  unsigned long currentMillis = millis();

  //-- draw progress bar
  lpg.draw(currentMillis);

  if ((unsigned long)(currentMillis - startedMillis) > duration) {
    //--- Duration's over: delay and start again!
    delay(900);
    initLpg();
  }

  // -- do some delay: frequent draw may cause broken visualization
  delay(100);
}
Github
https://github.com/wloche/LcdProgressBar

Schematics

Breadboard
Follow the wires and you'll get the the demo working like a charm :)
Lcdprogressbardouble bb
Schema
If you prefer, here is the electric schematic
Lcdprogressbardouble schema

Comments

Similar projects you might like

LCD (Liquid Crystal Display)

by MicroBob

  • 30,778 views
  • 40 comments
  • 101 respects

Lcd Display in Real Time.

Project tutorial by Youssef Sabaa

  • 23,654 views
  • 5 comments
  • 52 respects

Displaying Sensor Values on LCD

by Wimpie van den Berg

  • 47,653 views
  • 4 comments
  • 38 respects

LCD Backlight and Contrast Control

Project showcase by zurrealStudios

  • 5,575 views
  • 2 comments
  • 6 respects

Easily Wire a 16x2 LCD

Project showcase by ThomTronics

  • 2,779 views
  • 0 comments
  • 11 respects

LCD1602MkrUnoShield

by zhaoshentech

  • 1,270 views
  • 0 comments
  • 4 respects
Add projectSign up / Login