I've got some code I'm trying to adapt, the original code someone wrote and put on git displays data on a 1602 LCD. I'm trying to get it working on a Nokia 5110 LCD.
I have managed to some basic code to display some text:
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
void setup() {
display.begin();
display.clearDisplay(); // clears the screen and buffer
display.println("TEST");
display.display();
}
void loop() {
}
The problem I am having is in the original code it all configured to use classes and I can't figure out how to change this to use the 5110.
I've inserted
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
to the beginning of the sketch.
But these lines are confusing me:
DSPL(byte RS, byte E, byte DB4, byte DB5, byte DB6, byte DB7) : LiquidCrystal(RS, E, DB4, DB5, DB6, DB7) { }
and
DSPL disp(LCD_RS_PIN, LCD_E_PIN, LCD_DB4_PIN, LCD_DB5_PIN, LCD_DB6_PIN, LCD_DB7_PIN);
Am thinking I need to replace LiquidCrystal with Adafruit_PCD8544
and then need to change some of the calls so
void DSPL::init(void) {
LiquidCrystal::begin(8, 2);
LiquidCrystal::clear();
full_second_line = false;
}
becomes:
void DSPL::init(void) {
Adafruit_PCD8544::begin();
Adafruit_PCD8544::clearDisplay();
Adafruit_PCD8544::display();
full_second_line = false;
}
Some pointers would be appreciated. I read up a bit on classes but totally lost.