资 源 简 介
This library is intended to facilitate the creation of bar graphs for Arduino ...
It is very simple to use.
This is a simple example:
include
include
byte sensorPin = 0; // -- value for this example
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // -- creating LCD instance
LcdBarGraph lbg(&lcd); // -- creating bar graph
void setup(){
// -- initializing the LCD
lcd.begin(2, 16);
lcd.clear();
// -- do some delay: some time I"ve got broken visualization
delay(100);
lcd.setCursor(2, 0);
lcd.print("analog read");
}
void loop()
{
lcd.setCursor(0, 1);
// -- draw bar graph from the analog value readed
lbg.drawValue( analogRead(sensorPin), 1024, 10);
// lbg.drawValue(minimum, max, bargraph columns);
// -- do some delay: frequent draw may cause broken visualization
delay(100);
}