Hello!
I need help with the Nokia 5110 LCD. I cannot make it work.
First of all! I have follow this manual but it didin't work for me.
https://www.sparkfun.com/tutorials/300
I did this setup on the bread board.
And i tried to run this code:
#include "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();
}
And after that i installed the library for the LCD
I have installed the Adafruit-PCD8544-Nokia-5110-LCD-library in:
/usr/share/arduino/libraries
and the arduino IDE recognize it after restart the IDE.
(raring)acer@localhost:/usr/share/arduino/libraries$ ls
Adafruit_GFX Esplora OneWire SPI
Adafruit_PCD8544 Ethernet SD Stepper
DallasTemperatureControl Firmata Servo WiFi
EEPROM LiquidCrystal SoftwareSerial Wire
(raring)acer@localhost:/usr/share/arduino/libraries$ cd Adafruit_PCD8544
(raring)acer@localhost:/usr/share/arduino/libraries/Adafruit_PCD8544$ ls
Adafruit_PCD8544.cpp Adafruit_PCD8544.h examples license.txt README.txt
(raring)acer@localhost:/usr/share/arduino/libraries/Adafruit_PCD8544$
But it will not work for me!
I run the code above and i got this error message:
pcdtest.pde:1:21: fatal error: PCD8544.h: No such file or directory
compilation terminated.
Rename the files is not a good way beacuse it will be more issues then inside the file i think.
But if i rename the Adafruit_PCD8544.cpp to PCD8544.cpp and Adafruit_PCD8544.h to PCD8544.h and try to run the same code, i got this error message:
In file included from sketch_oct18a.ino:1:0:
/usr/share/arduino/libraries/Adafruit_PCD8544/PCD8544.h:52:46: error: expected class-name before ‘{’ token
sketch_oct18a.ino:5:1: error: ‘PCD8544’ does not name a type
sketch_oct18a.ino: In function ‘void setup()’:
sketch_oct18a.ino:9:3: error: ‘nokia’ was not declared in this scope
sketch_oct18a.ino: In function ‘void loop()’:
sketch_oct18a.ino:25:3: error: ‘nokia’ was not declared in this scope
And if i rename the code "#include "PCD8544.h" to "#include "Adafruit_PCD8544.h" and try to run the same code again i got this error message:
sketch_oct18a.ino:1:30: fatal error: Adafruit_PCD8544.h: No such file or directory
compilation terminated.
Here is a picture of the LCD im using:
Im not using the red one.