Advertisement
Guest User

LcdBarGraph.h

a guest
Jul 31st, 2011
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. /**
  2. * File: LcdBarGraph.h
  3. * Description:
  4. * LcdBarGraph is an Arduino library for displaying analog values in LCD display,
  5. * which is previously initialized. This library uses LiquedCrystal library for displaying.
  6. *
  7. * Author: Balazs Kelemen
  8. * Contact: prampec+arduino@gmail.com
  9. * Copyright: 2010 Balazs Kelemen
  10. * Copying permission statement:
  11. This file is part of LcdBarGraph.
  12.  
  13. LcdBarGraph is free software: you can redistribute it and/or modify
  14. it under the terms of the GNU General Public License as published by
  15. the Free Software Foundation, either version 3 of the License, or
  16. (at your option) any later version.
  17.  
  18. This program is distributed in the hope that it will be useful,
  19. but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. GNU General Public License for more details.
  22.  
  23. You should have received a copy of the GNU General Public License
  24. along with this program. If not, see <http://www.gnu.org/licenses/>.
  25.  
  26. */
  27.  
  28. #ifndef LCDBARGRAPH_H
  29. #define LCDBARGRAPH_H
  30.  
  31. #include <LiquidCrystal.h>
  32.  
  33. #include "WProgram.h"
  34.  
  35. class LcdBarGraph
  36. {
  37. public:
  38. /**
  39. * Create an instance of the class. A LiquidCristal instance should be passed. Unfortunately
  40. * the number of columns can't be read from the LiquidCrystal instance, so it should be passed.
  41. */
  42. LcdBarGraph(LiquidCrystal* lcd, byte numCols, byte startCol = 0, byte startRow = 0);
  43. /**
  44. * Draw a bargraph with a value between 0 and maxValue.
  45. */
  46. void drawValue(int value, int maxvalue);
  47. private:
  48. LiquidCrystal* _lcd;
  49. byte _numCols;
  50. byte _startCol;
  51. byte _startRow;
  52. int _prevValue;
  53. byte _lastFullChars;
  54.  
  55. static byte _level0[8];
  56. static byte _level1[8];
  57. static byte _level2[8];
  58. static byte _level3[8];
  59. static byte _level4[8];
  60. };
  61.  
  62. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement