Font issues - Adafruit GFX/PCD8544 libraries and Nokia 5110 display

I am trying to display sensor readouts in a larger-than-standard font size. It seems like the Adafruit libraries (PCD8544 and GFX) should let me do this. But when I try to use the ".setFont" function to call up a new font in a different size, I get a bunch of "no member named" errors. I've searched exhaustively and while it's probably something simple, these libraries should let me use these functions. I don't understand why "display.print" isn't a member of the Adafruit_PCD8544.h library. Help!

Error message (some redundant errors cut out):

Arduino: 1.8.8 (Mac OS X), Board: "Arduino/Genuino Uno"

In file included from /Users/akierstein15/Documents/Arduino/sketch_TEST_blend_button_advance/sketch_TEST_blend_button_advance.ino:40:0:
/Users/akierstein15/Documents/Arduino/libraries/Adafruit_PCD8544_Nokia_5110_LCD_library/Adafruit_PCD8544.h:69:46: error: expected class-name before '{' token
 class Adafruit_PCD8544 : public Adafruit_GFX {
                                              ^
/Users/akierstein15/Documents/Arduino/sketch_TEST_blend_button_advance/sketch_TEST_blend_button_advance.ino: In function 'void setup()':
sketch_TEST_blend_button_advance:108:11: error: 'class Adafruit_PCD8544' has no member named 'setFont'
   display.setFont(&FreeMonoBoldOblique12pt7b);
   
           ^
exit status 1
'class Adafruit_PCD8544' has no member named 'setFont'

And here’s the code I’m working with. Excuse the mess, it’s a mashup of a few different projects. And I should mention I’m using a SparkFun RedBoard (Uno R3).

// Libraries
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
#include <Adafruit_PCD8544.h> // replacing simple pcd8544.h to see if i can get fonts
#include <Wire.h>
#include <gfxfont.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <Fonts/FreeMonoBoldOblique12pt7b.h>


// Declarations
Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085); // declare sensor
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3); // declare LCD

// ******************************************************

//PINS

// Pins assigned to LED
const int ledRed1 = 11; // LEDs - anode connected to 5V thru 220ohm resistors

// Pins and declarations assigned to push button
const int pushButton = 8; // BUTTON ground pulldown low thru 330 ohm resistors
int buttonPushCounter = 0; // tracks button pushes
int buttonState = 0; // stores current state of button
int lastButtonState = 0; //stores previous state of button

// Pins and declarations assigned to potentiometer
const int potPin = A2; // analog pin for potentiometer
int potValue = 0; // stores value from pot
int potOutput = 0; // value to send to LED

// Pins and declarations for rotary encoder and interupts
int run; // declares the run function to enable button click to run program
static int pinA = 12; // Our first hardware interrupt pin is digital pin 2
static int pinB = 11; // Our second hardware interrupt pin is digital pin 3
int mapPos = 0;
volatile byte aFlag = 0; // expecting a rising edge on pinA to signal that the encoder has arrived at a detent
volatile byte bFlag = 0; // expecting a rising edge on pinB to signal that the encoder has arrived at a detent (opposite direction to when aFlag is set)
volatile int encoderPos = 0; //stores our current value of encoder position. Change to int or uin16_t instead of byte if you want to record a larger range than 0-255
volatile int oldEncPos = 0; //stores the last encoder position value. if changed prints to serial monitor
volatile byte reading = 0; //store the direct values we read from our interrupt pins before checking to see if we have moved a whole detent

// VOLTAGE SENSOR variables
int analogInput = A1; // VOLTMETER PIN
float vout = 0.0;
float vin = 0.0;
float R1 = 30000.0; //
float R2 = 7500.0; //
int value = 0;





void setup() {
  // INTERUPT PIN MODES
  pinMode(pinA, INPUT_PULLUP); // set pinA as an input, pulled HIGH to the logic voltage (5V or 3.3V for most cases)
  pinMode(pinB, INPUT_PULLUP); // set pinB as an input, pulled HIGH to the logic voltage (5V or 3.3V for most cases)
  pinMode(pushButton, INPUT_PULLUP);
  attachInterrupt(0, PinA, RISING); // set an interrupt on PinA, looking for a rising edge signal and executing the "PinA" Interrupt Service Routine (below)
  attachInterrupt(1, PinB, RISING); // set an interrupt on PinB, looking for a rising edge signal and executing the "PinB" Interrupt Service Routine (below)

  // set font



  //LCD initialization
  display.begin();
  display.setFont(&FreeMonoBoldOblique12pt7b);
  display.setContrast(55);
  display.setCursor(0, 0);
  display.print("BMP180 ");
  display.setCursor(0, 1);
  display.println("Initializing ");
  delay(500);

  display.setCursor(0, 0);
  display.println("Tacoma");
  display.setCursor(0, 1);
  display.println("Trip/Weather  ");
  display.setCursor(0, 2);
  display.println("Computer");
  delay(2000);
  display.clear();

  /* Initialise the sensor */
  if (!bmp.begin())
  {
    /* There was a problem detecting the BMP085 ... check your connections */
    display.setCursor(0, 0);
    display.print("BMP085 not detected");
    while (1);
  }
}

// INTERUPTS

void PinA() {
  cli(); //stop interrupts happening before we read pin values
  reading = PIND & 0xC; // read all eight pin values then strip away all but pinA and pinB's values
  if (reading == B00001100 && aFlag) { //check that we have both pins at detent (HIGH) and that we are expecting detent on this pin's rising edge
    encoderPos --; //decrement the encoder's position count
    bFlag = 0; //reset flags for the next turn
    aFlag = 0; //reset flags for the next turn
  }
  else if (reading == B00000100) bFlag = 1; //signal that we're expecting pinB to signal the transition to detent from free rotation
  sei(); //restart interrupts
}

void PinB() {
  cli(); //stop interrupts happening before we read pin values
  reading = PIND & 0xC; //read all eight pin values then strip away all but pinA and pinB's values
  if (reading == B00001100 && bFlag) { //check that we have both pins at detent (HIGH) and that we are expecting detent on this pin's rising edge
    encoderPos ++; //increment the encoder's position count
    bFlag = 0; //reset flags for the next turn
    aFlag = 0; //reset flags for the next turn
  }
  else if (reading == B00001000) aFlag = 1; //signal that we're expecting pinA to signal the transition to detent from free rotation
  sei(); //restart interrupts
}

void loop() {

  buttonState = digitalRead(pushButton); // reads button
  potValue = analogRead(potPin); // reads potentiometer
  potOutput = map(potValue, 0, 1023, 0, 255); // maps pot to PWM
  analogWrite(ledRed1, potOutput); // sets LED illumination level for panel

  if (buttonState != lastButtonState) { // compares to previous state to detect push
    if (buttonState == HIGH) { // if there's a push, button went on
      buttonPushCounter++; // increment counter
      delay(0);
    }
    lastButtonState = buttonState; // stores current click
  }

  if (buttonPushCounter == 1) { // if the button count is equal to 1
    programTemperature();
    delay(50);

  }
  if (buttonPushCounter == 2) {
    programVolt();
    delay(50);

  }

  if (buttonPushCounter == 3) {
    programAltitude();
    delay(50);
  }

  if (buttonPushCounter == 4) { // RESETS COUNTER TO 1
    delay(50);
    buttonPushCounter = 1;
  }

}

void programTemperature() {
  sensors_event_t event; // gets a sensor event from BMP
  bmp.getEvent(&event);
  if (event.pressure) /* Display the results (barometric pressure is measure in hPa) */
  {
    float temperature;
    bmp.getTemperature(&temperature);
    display.setCursor(0, 0);
    display.print("Temp.        ");
    display.setCursor(0, 2);
    display.print(temperature * 1.8 + 32);
    display.print(" F");
    display.setCursor(0, 3);
    display.print("          ");
  }
  delay(500);
}

void programCurrentPressure() {
  /* Get a new sensor event */
  sensors_event_t event;
  bmp.getEvent(&event);
  if (event.pressure) /* Display the results (barometric pressure is measure in hPa) */
  {
    /* Display atmospheric pressue in hPa */
    display.setCursor(0, 0);
    display.print("Current");
    display.setCursor(0, 1);
    display.print("Pressure: ");
    display.setCursor(0, 2);
    display.print("          ");
    display.setCursor(0, 3);
    display.print(event.pressure);
    display.print(" hPa");
  }
  delay(500);
}

void programAltitude() {
  /* Get a new sensor event */
  sensors_event_t event;
  bmp.getEvent(&event);
  if (event.pressure) /* Display the results (barometric pressure is measure in hPa) */
  {
    /* Display atmospheric pressue in hPa */
    display.setCursor(0, 0);
    display.print("Alt:   ");
    float seaLevelPressure = 985.44;
    float temperature;
    bmp.getTemperature(&temperature);
    display.setCursor(0, 1);
    display.print("          ");
    display.setCursor(0, 2);
    display.print("          ");
    display.setCursor(0, 3);
    display.print(bmp.pressureToAltitude(seaLevelPressure, event.pressure, temperature) * 3.28);
    display.print(" ft.    ");
    display.print("");
    /* A 'generic' value of     *
       1013.25 hPa can be used (defined as SENSORS_PRESSURE_SEALEVELHPA
       in sensors.h), but this isn't ideal and will give variable
       results from one day to the next. */
  }
  delay(500);
}

void programVolt() {

  value = analogRead(analogInput);
  vout = (value * 5.0) / 1024.0; // see text
  vin = vout / (R2 / (R1 + R2));
  display.setCursor(0, 0);

  display.print("Volt: ");

  display.setCursor(0, 1);
  display.print("          ");
  display.setCursor(0, 2);
  display.print(vin, 2);
  display.print("     ");
  display.setCursor(0, 3);
  display.print("          ");
  delay(500);
}

Run the IDE Library Manager from the Sketch Menu.

Update your Adafruit_GFX and Adafruit_PCD8544 libraries. And any other third party libraries that you are using.

It should not be necessary to include the SPITFT headers. They come with Adafruit_GFX.

David.

Thanks David. I tried that, and it didn't seem to help with the old sketch. But I did get the Adafruit PCD8544 library working on my display - had to change the pin assignments - and the code compiled after I carefully copied and pasted it into a new sketch. It could be that I didn't insert one of the Adafruit libraries into the old sketch correctly or something. Anyways, I think the "no named member exists" errors are resolved in the new sketch and I believe I should be able to get different text sizes working now.

If I figure out what specific thing made a difference, I'll update the thread for posterity. Otherwise, case closed.