Hello everyone.
Today I got an OLED display 128x32 pixels that uses the Adafruit SSD1306 and Adafruit GFX libraries.
I'm a beginner with arduino and this is my first display project. I want to display the value of a potentiometer in a custom font that I made (I'm simulating a speed imput, that's why the potentiometer value is divided by 10 in the code). If I don't include the new font and don't call it in the program everything works fine with the default font.
The problem I have is when I want to call the custom font, everywhere I see they use the function "display.setFont(font_name)", but when I'm going to use that function I get the error: no matching function for call to 'Adafruit_SSD1306::setFont(const uint8_t [2100])'
I included the .h file in the "Fonts" folder of the Adafruit GFX Library.
What am I doing wrong? The code is this:
#include <Wire.h> // include library for I2C
#include <Adafruit_SSD1306.h> // display library
#include <Adafruit_GFX.h> // graphics library
#include <Fonts/ferrari_288_GTO_128x32.h> // include custom font
#define SCREEN_WIDTH 128 // OLED display with in pixels
#define SCREEN_HEIGHT 32 // OLED display height in pixels
#define OLED_RESET 4 // define reset pin
#define SCREEN_ADDRESS 0x3C // define display direction
Adafruit_SSD1306 display(OLED_RESET);
void setup() {
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);
display.setFont(ferrari_288_GTO_128x32); // set text to custom font
display.setTextSize(1); // 1:1 scale
display.setTextColor(SSD1306_WHITE);// set display color
display.setCursor(0,0); // text coordinates (horizontal, vertical)
}
void loop() {
int potenciometro = analogRead (A0); // reads value of analog pin A0
Serial.println (potenciometro); // shows value on the serial monitor
delay (10); //
display.clearDisplay();
display.print(potenciometro/10); // Shows potentiometer value
display.display();
}
Thank you very much for your help