Need attiny85 OLED library

Hello. I tried getting this project going from the following youtube link

I downloaded the files for the code and libraries but I keep getting this error message:

'FONT6X8P' was not declared in this scope
Here is the complete code.

#include <TinyWireM.h>
#include <Tiny4kOLED.h>


#include "font16x32digits.h"


uint8_t width = 128;
uint8_t height = 32;


void setup() {
 
  pinMode(4,INPUT_PULLUP);
  pinMode(1,INPUT_PULLUP);
  pinMode(3,OUTPUT);
  oled.begin(width, height, sizeof(tiny4koled_init_128x32br), tiny4koled_init_128x32br);
 
  oled.clear();
  oled.on();

  // Switch the half of RAM that we are writing to, to be the half that is non currently displayed
  oled.switchRenderFrame();

  oled.setFont(FONT6X8P);
      oled.setCursor(5, 3);
      oled.print("American");
      delay(3000);
      oled.clear();
    
}
int minutes=2;
int seconds=0;
int fase=0;
int chosen=0;
int times[]={2,5,10,15,20,25,30,40};
int ani=14;

int debounce4=0;
int debounce1=0;
void loop() {


  if(fase==0 || fase==3){
  if(digitalRead(4)==0)
  {
    if(debounce4==0)
      {
      debounce4=1;
      chosen++;
      if(chosen>7)
      chosen=0;
      if(fase==3)
      fase=0;
      }
    }else{debounce4=0;}

    if(digitalRead(1)==0)
    {
    if(debounce1==0)
      {
      debounce1=1;
      minutes=times[chosen];
      fase=1;
      if(fase==3)
      fase=0;
      }
    }else{debounce1=0;}}

  if(fase==1 || fase==2){
 
  delay(1000);
  seconds--;
  if(seconds<=0)
    {
    seconds=59;
    minutes--;
    }}

  if(fase==3)
    {
      digitalWrite(3,1);
      delay(500);
      digitalWrite(3,0);
      delay(500);
      }

   if(minutes==0)
   fase=2;
   if(minutes==-1)
   fase=3;
   
   updateDisplay();
}

void updateDisplay() {

  oled.clear();

  if(fase==0)
     {
      oled.setFont(FONT6X8P);
      oled.setCursor(0, 0);
      oled.print(" SET TIME:");
      oled.setCursor(0, 1);
      oled.print("----------------------");
      oled.setCursor(0, 2);
      for(int i=0;i<8;i++)
        {
           oled.print(" ");
           oled.print(times[i]);
        }
        if(chosen == 2)
        oled.setCursor(32,3 );
        else if(chosen == 3)
        oled.setCursor(50,3);
        else if(chosen>3)
        oled.setCursor(chosen*17, 3);
        else
        oled.setCursor(6+chosen*12, 3);
        oled.print("^");
      }

  if(fase==1){
   oled.setFont(FONT6X8P);
   oled.setCursor(8, 0);
   oled.print("TIME:");
   oled.setFont(FONT8X16P);
 
 
  oled.setCursor(8, 1);
 if(minutes<10)
 oled.print(0);
 oled.print(minutes);
 oled.print(" : ");
  if(seconds<10)
 oled.print(0);
 oled.print(seconds);
 oled.setFont(FONT6X8P);
 oled.setCursor(8, 3);
  for(int i=ani;i>0;i--)
  {
    oled.print(".");
           
  }
     ani--;
     if(ani==0)
     ani=14;
  }

  if(fase==2)
  {
    oled.setFont(FONT16X32DIGITS);
    oled.setCursor(8, 0);
    oled.print(seconds);
  }
 
  oled.switchFrame();
}

Did you try <font16x32digits.h> instead of "font16x32digits.h"?

See this thread for the difference between #include "file.h" and #include <file.h>.

If that doesn't work, try copying the font16x32digits.h file to a tab in your program and use #include "font16x32digits.h".

I tried changing <font16x32digits.h> instead of "font16x32digits.h"
The problem is here where it says
oled.setFont(FONT6X8P);

This is the error message
'FONT6X8P' was not declared in this scope

if(fase==1){
   oled.setFont(FONT6X8P);
   oled.setCursor(8, 0);
   oled.print("TIME:");
   oled.setFont(FONT8X16P);

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

Oh, sorry. Here is the error message

Arduino: 1.8.13 (Windows 10), Board: "Arduino Uno"





















C:\Users\elopez28\Documents\Arduino\sketch_attinyOLEDtimer\sketch_attinyOLEDtimer.ino: In function 'void setup()':

sketch_attinyOLEDtimer:25:16: error: 'FONT6X8P' was not declared in this scope

   oled.setFont(FONT6X8P);

                ^~~~~~~~

C:\Users\elopez28\Documents\Arduino\sketch_attinyOLEDtimer\sketch_attinyOLEDtimer.ino:25:16: note: suggested alternative: 'FONT6X8'

   oled.setFont(FONT6X8P);

                ^~~~~~~~

                FONT6X8

C:\Users\elopez28\Documents\Arduino\sketch_attinyOLEDtimer\sketch_attinyOLEDtimer.ino: In function 'void updateDisplay()':

sketch_attinyOLEDtimer:102:20: error: 'FONT6X8P' was not declared in this scope

       oled.setFont(FONT6X8P);

                    ^~~~~~~~

C:\Users\elopez28\Documents\Arduino\sketch_attinyOLEDtimer\sketch_attinyOLEDtimer.ino:102:20: note: suggested alternative: 'FONT6X8'

       oled.setFont(FONT6X8P);

                    ^~~~~~~~

                    FONT6X8

sketch_attinyOLEDtimer:125:17: error: 'FONT6X8P' was not declared in this scope

    oled.setFont(FONT6X8P);

                 ^~~~~~~~

C:\Users\elopez28\Documents\Arduino\sketch_attinyOLEDtimer\sketch_attinyOLEDtimer.ino:125:17: note: suggested alternative: 'FONT6X8'

    oled.setFont(FONT6X8P);

                 ^~~~~~~~

                 FONT6X8

sketch_attinyOLEDtimer:128:17: error: 'FONT8X16P' was not declared in this scope

    oled.setFont(FONT8X16P);

                 ^~~~~~~~~

C:\Users\elopez28\Documents\Arduino\sketch_attinyOLEDtimer\sketch_attinyOLEDtimer.ino:128:17: note: suggested alternative: 'FONT8X16'

    oled.setFont(FONT8X16P);

                 ^~~~~~~~~

                 FONT8X16

exit status 1

'FONT6X8P' was not declared in this scope



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

OK, it looks like that if you want to use those fonts, you will need to include their .h files, too.

Add:

#include <font6x8.h>
#include <font8x16p.h>

or

#include "font6x8.h."
#include "font8x16p.h"

I tried copy and pasting both but I get

font8x16p.h: No such file or directory

Is there such a file, anywhere on your system?

How did you install the Tiny4kOLED library?
That library is available via the IDE library manager. Did you install it that way?

The font files should be in the Tiny4kOLED library folder in your libraries folder in your sketchbook.

This is the error message that I get

A library named Tiny4kOLED-master already exists
A library named TinyOLED-Fonts-master already exists

Before you try to install the library with the library manager, delete the old libraries from your sketchbook\libraries folder.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.