AnalogVisualization.ino 643 B

123456789101112131415161718192021222324
  1. #include <LiquidCrystal.h>
  2. #include <LcdBarGraphX.h>
  3. byte lcdNumCols = 16; // -- number of columns in the LCD
  4. byte sensorPin = 0; // -- value for this example
  5. LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // -- creating LCD instance
  6. LcdBarGraphX lbg(&lcd, lcdNumCols); // -- creating
  7. void setup(){
  8. // -- initializing the LCD
  9. lcd.begin(2, lcdNumCols);
  10. lcd.clear();
  11. // -- do some delay: some time I've got broken visualization
  12. delay(100);
  13. }
  14. void loop()
  15. {
  16. // -- draw bar graph from the analog value readed
  17. lbg.drawValue( analogRead(sensorPin), 1024);
  18. // -- do some delay: frequent draw may cause broken visualization
  19. delay(100);
  20. }