| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Graphical LCD

Page history last edited by David S 9 years, 9 months ago

LIBRARY CODE

 

1) Download these two zip files: Adafruit_PCD8544.zip and Adafruit_GFX.zip. Open Arduino and use the Sketch > Import Library > Add Library menu to select and install each zip file (not the unzipped folders!). This will add a sketch under Examples > Adafruit_PCD8544 > pcdtest.

 

Note: If your computer automatically puts the zip files into the trash, copy them someplace else temporarily; the installer needs to use the zip file.

 

2) Create a folder ~\Arduino\Strings (on Windows) or ~/Documents/Arduino/Strings/ (on OSX) and move Strings.ino to it. This will add a sketch under Sketchbook > Strings.

 

3) Download and extract GraphicsExample.zip, and add the unzipped folder to ~\Arduino\ (on Windows) or ~/Documents/Arduino/ (on OSX). This will add a sketch under Sketchbook > GraphicsExample.

 

4) You'll likely have to restart Arduino to see the new sketches, so do that now.

 

Note: these steps have already been completed on the lab computer(s).

 

API

 

Basic Functions

 

Adafruit_PCD8544(int8_t SCLK, int8_t DIN, int8_t DC, int8_t CS, int8_t RST) constructor
void begin(uint8_t contrast = 40); initializes display and sets contrast to a default value
void setContrast(uint8_t val);
sets contrast of display

void display();

void clearDisplay(void);

pushes the buffer to the screen

clears the screen and buffer

void drawPixel(int16_t x, int16_t y, uint16_t color);
draws a single pixel at (x,y) on display (color = BLACK for our purposes)
uint8_t getPixel(int8_t x, int8_t y);
returns "color" of pixel at (x,y)
invertDisplay(boolean i);
change display to white-on-black
void setCursor(int16_t x, int16_t y);
move cursor to pixel (x,y)
void setTextSize(uint8_t s);
sets the size of the text
void setTextWrap(boolean w);
defines wrapping for text
void setRotation(uint8_t r); rotates display

 

Graphical Functions

 

void drawPixel(int16_t x, int16_t y, uint16_t color);
draws a single pixel at (x,y) on display (color = BLACK for our purposes)
uint8_t getPixel(int8_t x, int8_t y);
returns "color" of pixel at (x,y)
virtual void void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color); draws a line from pixel (x0,y0) to (x1, y1)
virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
draws a vertical line from pixel (x,y) with length=h
virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
draws a horizontal line from pixel (x,y) with length=w
virtual void drawRect(int16_t x, int16_t y, int16_t w, int16_t h,
uint16_t color);
draws an empty rectangle with top left corner at (x,y), width=w, and height=h
virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); draws a filled rectangle with top left corner at (x,y), width=w, and height=h
virtual void fillScreen(uint16_t color);
fills the entire screen
void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
draws an empty circle with center at (x0,y0) and radius=r
void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
draws a filled circle with center at (x0,y0) and radius=r
void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color); draws an empty triangle with corners at (x0,y0), (x1,y1), and (x2,y2)
void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color); draws a filled triangle with corners at (x0,y0), (x1,y1), and (x2,y2)
void drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color); draws an empty rectangle with rounded corners, top left corner at (x,y), width=w, and height=h
void fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color); draws a filled rectangle with rounded corners, top left corner at (x,y), width=w, and height=h
void drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color); draws file *bitmap with upper left corrner at (x,y) and size width=w and height=h

  

DATA SHEET

Nokia 5110 Screen Datasheet

 

PINOUT

 

 

Comments (0)

You don't have permission to comment on this page.