Skip to content

Commit

Permalink
Creating the doc
Browse files Browse the repository at this point in the history
  • Loading branch information
pfaivre committed Oct 18, 2014
1 parent f87b6ed commit a66f1d1
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 30 deletions.
36 changes: 6 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,20 @@
LcdHistogram
============

Still in developpement...

A simple LCD histogram library for Arduino inspired by [spark](https://github.com/holman/spark).

This library allows you to plot a set of data as a histogram on a LCD screen.
For example, to draw the data set {1, 12, 3, 9, 10, 8, 0, 5}, it will show something like `▁█▂▆▇▅ ▄`.

## Usage
LcdHistogram is a class allowing to print a graph on the screen. The following methods are available:
![LcdHistogram in work](docs/LcdHistogram_example.jpg)

---
```
LcdHistogram(LiquidCrystal* lcd, int posx, int posy, int length);
```
Creates a new histogram.
Parameters:
* `lcd` - An instance of LiquidCrystal previously created
* `posx` - Row on the screen of the first bar
* `posy` - Line on the screen of the first bar
* `length` - Length of the histogram in characters

---
```
push(float number);
```
Add a number in the histogram.
Parameter:
* `number` - A single data to add at the end

---
```
plot();
```
Print the graph.
## Usage
Just download and extract this repository in your [Arduino library](http://arduino.cc/en/Guide/Libraries) folder.
LcdHistogram is a class allowing to print a graph on the screen.
See the [docs/](docs) to know how to use it.

Example:
```
```c++
#include <LiquidCrystal.h>
#include <LcdHistogram.h>

Expand Down Expand Up @@ -66,6 +43,5 @@ void loop() {
}
```


## License
Copyright 2014 Pierre Faivre. This is free software, and may be redistributed under the terms specified in the LICENSE file.
Binary file added docs/LcdHistogram_example.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
How to use it
=============

## Class LcdHistogram

---
```c++
LcdHistogram(LiquidCrystal* lcd, int posx, int posy, int length);
```
Creates a new histogram.
Parameters:
* `lcd` - An instance of LiquidCrystal previously created
* `posx` - Row on the screen of the first bar
* `posy` - Line on the screen of the first bar
* `length` - Length of the histogram in characters
---
```c++
void push(float number);
```
Adds a number in the histogram.
Parameter:
* `number` - A single data to add at the end

---
```c++
void plot();
```
Print the graph.

---
```c++
void setMode(GraphMode m);
```
Change the way the graph is being printed.
Parameter:
* `m` - New mode
## Enum GraphMode
Defines the drawing behavior
For example, for the numbers {80, 95, 100, 70, 90}, it will print :
* ABSOLUTE : ▆██▆▇
* DYNAMIC : ▃▇█ ▅
---
```c++
ABSOLUTE
```
Draw each bar considering 0 as minimum value.

---
```c++
DYNAMIC
```
Get the chart more readable by adjusting the length of the bars according to the minimum value.

0 comments on commit a66f1d1

Please sign in to comment.