Missing Adafruit_SSD1306 library

I’ve been trying to get this Arduino Master Midi clock to work. No luck. I seem to get this same message any time I try to use one of these little displays. Anybody know what may be happening? Master Midi Clock

Arduino: 1.8.13 Hourly Build 2020/06/16 12:33 (Windows 10), Board: “Arduino Nano, ATmega328P (Old Bootloader)”

sketch_jun23a:28:10: fatal error: Adafruit_SSD1306.h: No such file or directory

#include <Adafruit_SSD1306.h>

      ^~~~~~~~~~~~~~~~~~~~

compilation terminated.

exit status 1

Adafruit_SSD1306.h: No such file or directory

1 Like

This probably belongs in a different topic.

2 Likes

Have you installed the proper libraries for the displays? You can do this in the arduino IDE.

Sketch -> include library -> manage libraries -> enter ‘SSD1306’ and the Adafruit library will be shown. You can now install it and recompile your code. The error should not occur any more.

4 Likes

That I have not done. Thanks for the tip! Will check it out.

That worked! Now I have another. I know nothing about these things.

Arduino: 1.8.13 Hourly Build 2020/06/16 12:33 (Windows 10), Board: “Arduino Nano, ATmega328P (Old Bootloader)”

sketch_jun23a:30:10: fatal error: Encoder.h: No such file or directory

#include <Encoder.h>

      ^~~~~~~~~~~

compilation terminated.

exit status 1

Encoder.h: No such file or directory

The libraries you need to install are listed at the top of the source file:

 * Required library
 *    TimerOne https://playground.arduino.cc/Code/Timer1
 *    Encoder https://www.pjrc.com/teensy/td_libs_Encoder.html
 *    MIDI https://github.com/FortySevenEffects/arduino_midi_library
 *    Adafruit SSD1306 https://github.com/adafruit/Adafruit_SSD1306

No idea if they’re all available in the Arduino IDE, but a lot of things are so it’s worth checking.

4 Likes

Oh! Ok. Starting to make sense to me. I did add all the libraries, but now it just seems to snowball. I get lost here.

Arduino: 1.8.13 Hourly Build 2020/06/16 12:33 (Windows 10), Board: “Arduino Nano, ATmega328P (Old Bootloader)”

C:\Users\phree\OneDrive\Desktop\Master Midi Clock\sketch_jun23a\sketch_jun23a.ino: In function ‘void setup()’:

sketch_jun23a:81:3: error: ‘Timer1’ was not declared in this scope

Timer1.initialize(intervalMicroSeconds);

^~~~~~

C:\Users\phree\OneDrive\Desktop\Master Midi Clock\sketch_jun23a\sketch_jun23a.ino: In function ‘void updateBpm()’:

sketch_jun23a:261:3: error: ‘Timerone’ was not declared in this scope

Timerone.setPeriod(interval);

^~~~~~~~

exit status 1

‘Timer1’ was not declared in this scope

1 Like

Well, Timer1 is declared in the TimerOne library:

#include "TimerOne.h"
TimerOne Timer1;              // preinstatiate

so if Arduino’s saying otherwise, that suggests there’s still something wrong with your libraries. Evidently it’s seeing the header file TimerOne.h, but not the library itself.

2 Likes

You need to go over the requirements of the code specified for the midi master code project. Probably its documentation states what libraries you need. There might be a few. But sometimes documentation is incomplete so you are left to sort things out yourself. What is also very important is that you choose the device you want to program accurately. Depending on the device some libraries internally use different code segments because of the differences between the devices. So e.g. if you install a library on an arduino nano that might use different code sections than a wemos D1 in the same library. You may then get error messages compiling for the one device that you will not get with seemingly the same code for the other.

1 Like

try the library sample code.

/*
  • Timer1 library example
  • June 2008 | jesse dot tane at gmail dot com
    */

#include “TimerOne.h”

void setup()
{
pinMode(10, OUTPUT);
Timer1.initialize(500000); // initialize timer1, and set a 1/2 second period
Timer1.pwm(9, 512); // setup pwm on pin 9, 50% duty cycle
Timer1.attachInterrupt(callback); // attaches callback() as a timer overflow interrupt
}

void callback()
{
digitalWrite(10, digitalRead(10) ^ 1);
}

void loop()
{
// your program here…
}

1 Like

I got the full sketch to compile on a fresh install of IDE.

Did have to add another library

Adafruit_GFX

Do you get any errors about “Multiple Libraries Found”

1 Like

I’m still stuck at the same place. This stuff is kinda gibberish to me.

1 Like

Have you been able to install the library?

If so, does it have any examples you might give a go, to learn a bit about what it does?

Start with the library example I posted above.

Don’t even need to upload it if it compiles.

Then do the same, find examples for the other libraries and test them.

or post your code as “preformatted text” , one of us may be able to replicate it.

Rob

where has Timerone come from?

the original code says Timer1

Timer1.initialize(intervalMicroSeconds);
Timer1.setPeriod(60L * 1000 * 1000 / bpm / CLOCKS_PER_BEAT);
Timer1.attachInterrupt(sendClockPulse);

It may be a synonym But it would be TimerOne not Timerone

TimerOne is a class; Timer1 is an instance of TimerOne.

More colloquially TimerOne names a type of object; Timer1 names a particular object of that type.

Timerone is probably undefined. If you have that in your sketch, it should be changed to Timer1. Probably. I mean, depends on what’s in the sketch, but if you haven’t declared Timerone to be an instance of TimerOne, then it probably should be Timer1.

I’m glad I don’t have to try to explain that orally.

2 Likes

You lost me at “Timerone is a Class” LOL…

I never really learned C of any sort… My general programming tailed off after University and was more linux bash scripting… So there are a lot of concepts I am still fathoming out…

Rob

That’s why I put the translation in the next sentence.

It’s like if you have a dog named Dog. “dog” identifies a species, “Dog” identifies a particular dog. And “DOG” or “dOg” or “dOG” are mistakes.

2 Likes

The point is that these are all different kinds of entity. A class in programming is a category to which certain objects belong. In common English, to force a comparison, Police Officer is a category to which certain people belong. You might choose to call a Police Officer by the name Police Officer, and that would be confusing the rank with the identity. And this is exactly what is happening here. The name of the object is close to the class to which it belongs, and you’re right to be confused.

Joe Heller satirised this in Catch-22 by having one of its characters whose surname was Major and whose father named him Major Major Major as a joke. On joining the military the poor fellow is accidentally promoted to the rank of Major. Thus he becomes Major Major Major Major, a burden he finds completely unsuited to his meek temperament.

I strongly recommend you ask some joker on this thread to rewrite the offending code in a way that doesn’t cause such confusion.

2 Likes

@Doolang

Replace all instances of Tmerone with TimerOne and see if that sorts it.

If not then download the code again as it uses Timer1 thrpughout the code and not TimerOne.