AndrewFromMelbourne/LcdRowGraph
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
The LcdRowGraph library is a templated class that uses the LiquidCrystal
library (or similar) and the user defineable characters (via createChar) to
provide a row graph that extends across a number of columns and can display
five different levels per column. For example in a 16x2 LCD display the
graph can display up to 80 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 LcdRowGraph 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);
LcdRowGraph<LiquidCrystal> lcdRowGraph(lcd, 0, 80, 1);
The advantage of using a template is that you can use any LiquidCrystal
library with this class. For example LiquidCrystal_I2C.
To use the code you need to create an LcdRowGraph object. 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 row
The display row where the graph will be drawn
uint8_t firstColumn
The first column of the graph (default is 0)
uint8_t lastColumn
The last column of the graph (default is 15)
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 16 columns the graph can have an unscaled value
between 0 and 80.
uint8_t getRow() const;
Returns the row 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.