LCD5110 Graph
LCD5110 Graph
Manual
Basic functionality of this library are based on the demo-code provided by ITead studio. You
can find the latest version of the library at http://www.henningkarlsen.com/electronics
If you make any modifications or improvements to the code, I would appreciate that you share
the code with me so that I might include it in the next release. I can be contacted through
http://electronics.henningkarlsen.com/contact.php.
LCD5110_Graph Page 2
Defined Literals:
Alignment
For use with print(), printNumI() and printNumF()
LEFT: 0
RIGHT: 9999
CENTER: 9998
Included Fonts:
TinyFont
SmallFont
MediumNumbers
BigNumbers
LCD5110_Graph Page 3
Functions:
LCD5110(SCK, MOSI, DC, RST, CS);
The main class constructor.
InitLCD([contrast]);
Initialize the LCD.
setContrast(contrast);
Set the contrast of the LCD.
enableSleep();
Put the display in Sleep Mode.
Parameters: None
Usage: myGLCD.enableSleep(); // Put the display into Sleep Mode
Notes: update() will not work while the display is in Sleep Mode.
Entering Sleep Mode will not turn off the backlight as this is a hardware function.
disableSleep();
Re-enable the display after it has been put in Sleep Mode.
Parameters: None
Usage: myGLCD.disableSleep(); // Wake the display after putting it into Sleep Mode
Notes: The display will automatically be updated with the contents of the buffer when Sleep Mode is
disabled.
Exiting Sleep Mode will not turn on the backlight as this is a hardware function.
LCD5110_Graph Page 4
update();
Copy the screen buffer to the screen.
This is the only command, except invert(), that will make anything happen on the physical screen. All other commands only
modify the screen buffer.
Parameters: None
Usage: myGLCD.update(); // Copy the screen buffer to the screen
Notes: Remember to call update() after you have updated the screen buffer.
Calling update() while the display is in Sleep Mode will not have any effect.
clrScr();
Clear the screen buffer.
Parameters: None
Usage: myGLCD.clrScr(); // Clear the screen buffer
fillScr();
Fill the screen buffer.
Parameters: None
Usage: myGLCD.fillScr(); // Fill the screen buffer
invert(mode);
Set inversion of the display on or off.
setPixel(x, y);
Turn on the specified pixel in the screen buffer.
clrPixel(x, y);
Turn off the specified pixel in the screen buffer.
invPixel(x, y);
Invert the state of the specified pixel in the screen buffer.
LCD5110_Graph Page 5
print(st, x, y);
Print a string at the specified coordinates in the screen buffer.
You can use the literals LEFT, CENTER and RIGHT as the x-coordinate to align the string on the screen.
invertText(mode);
Select if text printed with print(), printNumI() and printNumF() should be inverted.
setFont(fontname);
Select font to use with print(), printNumI() and printNumF().
Parameters: fontname: Name of the array containing the font you wish to use
Usage: myGLCD.setFont(SmallFont); // Select the font called SmallFont
Notes: You must declare the font-array as an external or include it in your sketch.
LCD5110_Graph Page 6
drawLine(x1, y1, x2, y2);
Draw a line between two points in the screen buffer.
drawCircle(x, y, radius);
Draw a circle with a specified radius in the screen buffer.
clrCircle(x, y, radius);
Clear a circle with a specified radius in the screen buffer.
LCD5110_Graph Page 7
drawBitmap (x, y, data, sx, sy);
Draw a bitmap in the screen buffer.
LCD5110_Graph Page 8