Jag behöver hjälp med Nokia 5110 LCD. Jag får den inte att fungera. Jag tänker bara skriva ut text på skärmen.
Det jag har gjort är att följt denna manual. Mycket enkelt.
https://www.sparkfun.com/tutorials/300
Det här är min installation

Och jag har försökt köra denna kod.
Kod: Markera allt
#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();
}
https://github.com/adafruit/Adafruit-PC ... CD-library
Jag har installerat Adafruit-PCD8544-Nokia-5110-LCD-library i:
Kod: Markera allt
/usr/share/arduino/libraries
Kod: Markera allt
(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$
Om jag kör koden som finns ovan så får jag detta errormeddelade:
Men om jag ändrar namnet på Adafruit_PCD8544.cpp til PCD8544.cpp och Adafruit_PCD8544.h till PCD8544.h och försöker att köra samma kod igen så får jag detta errormeddelande:pcdtest.pde:1:21: fatal error: PCD8544.h: No such file or directory
compilation terminated.
Kod: Markera allt
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
Och om jag ändrar namnet på koden "#include "PCD8544.h" till "#include "Adafruit_PCD8544.h" och kör samma kod igen så får jag detta errormeddeladen:
Kod: Markera allt
sketch_oct18a.ino:1:30: fatal error: Adafruit_PCD8544.h: No such file or directory
compilation terminated.

Det är inte den röda.
Jag har Arduino 1.0.3 men det ska fungera med detta bibliotek.
Om jag byter namn på Adafruit_PCD8544 to PCD8544 och Adafruit_PCD8544.h till PCD8544.h och Adafruit_PCD8544.cpp till PCD8544.cpp
Kod: Markera allt
(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$
Kod: Markera allt
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