Need help with the Nokia 5110 LCD

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.

Seems to me like you're using samples which don't use the same library as you are, or the versions are different.
Make sure that the library and samples you are using are compatible.
You may also want to check out my library for this display, it comes with a sample sketch you can try.
http://forum.arduino.cc/index.php?topic=176794

Also if you would like to try some 5110 code without any libraries this guy has a really good tutorial and a couple of interesting pieces of code. Nice guy too
Pedro XD
http://ianlangelectronic.webeden.co.uk/#/lcd-module-0/4569058582

This thread may help

http://forum.arduino.cc//index.php?topic=191172.msg1415169#msg1415169

And I've had success with Henning Karlsen's library.

I just want to send out some text only.
I have Arduino 1.0.3

If i rename the the folder Adafruit_PCD8544 to PCD8544 and Adafruit_PCD8544.h to PCD8544.h and Adafruit_PCD8544.cpp to PCD8544.cpp

(raring)acer@localhost:/usr/share/arduino/libraries$ ls
Adafruit_GFX              Ethernet       PCD8544         SPI
DallasTemperatureControl  Firmata        SD              Stepper
EEPROM                    LiquidCrystal  Servo           WiFi
Esplora                   OneWire        SoftwareSerial  Wire
(raring)acer@localhost:/usr/share/arduino/libraries$ cd PCD8544
(raring)acer@localhost:/usr/share/arduino/libraries/PCD8544$ ls
examples  license.txt  PCD8544.cpp  PCD8544.h  README.txt
(raring)acer@localhost:/usr/share/arduino/libraries/PCD8544$

I got this error message:

In file included from sketch_oct19a.ino:1:0:
/usr/share/arduino/libraries/PCD8544/PCD8544.h:52:46: error: expected class-name before ‘{’ token
sketch_oct19a.ino:5:1: error: ‘PCD8544’ does not name a type
sketch_oct19a.ino: In function ‘void setup()’:
sketch_oct19a.ino:9:3: error: ‘nokia’ was not declared in this scope
sketch_oct19a.ino: In function ‘void loop()’:
sketch_oct19a.ino:25:3: error: ‘nokia’ was not declared in this scope

The colour of the board is immaterial. The pin layout is the same as my red ones anyway. What does matter is how the 5110 is wired to the Arduino. If you use the standard Philips PCD8544 library, the instruction is incorporated therein. Other libraries may leave this to the programme.

It might pay to at least try to understand how the 5110 works, and is connected. The tutorial here
http://blog.stuartlewis.com/2011/02/12/scrolling-text-with-an-arduino-and-nokia-5110-screen/
doesn't use a library.

I got this error message:

In file included from sketch_oct19a.ino:1:0:
/usr/share/arduino/libraries/PCD8544/PCD8544.h:52:46: error: expected class-name before ‘{’ token
sketch_oct19a.ino:5:1: error: ‘PCD8544’ does not name a type

[/quote]

look at line 53 in Arduino_PCD8544.h
class Adafruit_PCD8544 : public Adafruit_GFX {

So, you need Adafruit_GFX as this library needs it. You seem to have it, but the compiler can't find it.

You shouldn't rename the library as I believe the class name is supposed to be the same as the folder on the Arduino. This may be your problem.

Sharing link to a simple library to use in case someone lands on this page. I had a lot of trouble to make Nokia 5110 work with my UNO:

https://github.com/nitins11/Arduino/tree/master/libraries/Nokia5110Lib