70 lines
1.4 KiB
C++
Executable File
70 lines
1.4 KiB
C++
Executable File
#include <Adafruit_GFX.h>
|
|
|
|
#include <SPI.h>
|
|
|
|
#include "Adafruit_PCD8544.h"
|
|
//Define the pins you are connecting the LCD too.
|
|
//PCD8544(SCLK, DIN/MOSI, D/C, SCE/CS, RST);
|
|
PCD8544 nokia = PCD8544(3,4,5,7,6);
|
|
|
|
void setup(void)
|
|
{
|
|
nokia.init(); //Initialize lcd
|
|
// set display to normal mode
|
|
nokia.command(PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYNORMAL);
|
|
nokia.clear(); //Clear the display
|
|
}
|
|
|
|
void loop(void)
|
|
{
|
|
// For all functions:
|
|
// x range is 0-84
|
|
// y range is 0-48
|
|
// color is BLACK or WHITE
|
|
|
|
int pause=2000;
|
|
// draw a single pixel
|
|
// nokia.setPixel(x, y, color);
|
|
nokia.setPixel(30, 30, BLACK);
|
|
nokia.display();
|
|
delay(pause);
|
|
nokia.clear();
|
|
|
|
// draw line
|
|
// nokia.drawline(x1,y1,x2,y2,color); draws a line from (x1,x2) to (y1,y2)
|
|
nokia.drawline(5,5,15,40,BLACK);
|
|
nokia.display();
|
|
delay(pause);
|
|
nokia.clear();
|
|
|
|
// draw rectangle
|
|
// nokia.drawrect(x1,y1,x2,y2,color);
|
|
//draws a rectange with top left @ (x1,x2) and bottom right @ (y1,y2)
|
|
nokia.drawrect(1,1,30,30,BLACK);
|
|
nokia.display();
|
|
delay(pause);
|
|
nokia.clear();
|
|
|
|
// draw filled rectangle
|
|
nokia.fillrect(10,10,20,20,BLACK);
|
|
nokia.display();
|
|
delay(pause);
|
|
nokia.clear();
|
|
|
|
// draw circle
|
|
// nokia.drawcircle(x,y,r,color);
|
|
// x,y position with a radius of r
|
|
nokia.drawcircle(30,20,5,BLACK);
|
|
nokia.display();
|
|
delay(pause);
|
|
nokia.clear();
|
|
|
|
// draw filled circle
|
|
nokia.fillcircle(10,10,5,BLACK);
|
|
nokia.display();
|
|
delay(pause);
|
|
nokia.clear();
|
|
|
|
}
|
|
|