AndrewFromMelbourne/LcdColumnGraph
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
The LcdColumnGraph library is a templated class that uses the LiquidCrystal
library (or similar) and the user defineable characters (via createChar) to
provide a column graph that extends across a number of rows and can display
eight different levels per row. For example in a two row LCD display the
graph can display 16 different levels (not including zero). While the code
is reasonably general, it does assume a 5x8 pixel LCD character.
To use the code you need to create an LcdColumnGraph object, using the
specific class that implements the calls to the LCD. For example to use the
class with the standard LiquidCrystal class you create the object like this.
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
LcdColumnGraph<LiquidCrystal> lcdColumnGraph(lcd, 0, 10, 0);
The advantage of using a template is that you can use any LiquidCrystal
library with this class. For example LiquidCrystal_I2C.
The constructor take the following parameters:-
LiquidCrystal_T& lcd
An object of the class you are using to drive the LCD.
int32_t min
The minimum value to be graphed
int32_t max
The maximum value to be graphed
uint8_t column
The display column where the graph will be drawn
uint8_t firstRow
The first row of the graph (default is 0)
uint8_t lastRow
The last row of the graph (default is 1)
The methods are as follows:
void value(int32_t value);
Set the graph to 'value', scaled between min and max.
void unscaled(uint8_t value);
The unscaled method allows you to to set the graph to a specific
level without using a scale between min and max. For example if the
graph is over two rows the graph can have an unscaled value between
0 and 16.
uint8_t getColumn() const;
Returns the column number where the graph will be displayed
void setColumn(uint8_t column);
Set the column number where the graph will be displayed
int32_t getMin() const;
Get the minimum value that the graph is mapped to.
int32_t getMax() const;
Get the maximum value that the graph is mapped to.
void setMinMax(int32_t min, int32_t max);
Set the minimum and maximum values that the graph is mapped to.