As you guessed, this is not a bug with the "Adafruit SSD1306" library.
It's also not a bug with the Arduino Web Editor.
Unlike the Arduino IDE, where you must install libraries on demand, all the thousands of libraries in the Arduino Library Manager index are pre-installed on Arduino Web Editor. This is very convenient, but it can also cause some occasional problems. The issue is that with so many libraries installed it's more likely that two libraries will have the same header filename. When this happens, the Arduino dependency resolution system tries to pick the correct library, but there's really no way for it to make the right pick every time. The Arduino IDE would have the same problem if you had the two conflicting libraries installed. That was the case here. If you scroll up in the console output, you'll see this message:
Multiple libraries were found for "Adafruit_SSD1306.h"
Used: /home/builder/opt/libraries/latest/adafruit_ssd1306_wemos_mini_oled_1_1_2
Not used: /home/builder/opt/libraries/latest/adafruit_ssd1306_2_2_1
The library the sketch was written for is "Adafruit SSD1306", but the library the build system picked was "Adafruit SSD1306 WeMos Mini OLED".
The way to fix it is to influence the dependency resolution system to give priority to the "Adafruit SSD1306" library. There are a few ways you can do this. Note that you only need to do one of the following options, not all three. I'm explaining all the options because each has its own advantages. Although any of the three will work with this particular library, in other cases you will find that only the third option is possible:
The first option is to add an #include directive for a header file that's unique to the library you want before the ambiguous #include directive. In this case, there is a unique header file named splash.h. So you only need to add this line above the #include directive for Adafruit_SSD1306.h:
#include <splash.h>
This solution only works when the library has a header file with a unique name. To find that out for any future libraries you might have this problem with, you can download the library from Arduino Web Editor by hovering the mouse pointer over the library name in your "Favorites", clicking the downward pointing triangle to the right of the library name, then clicking "Download Library". Unzip the downloaded library, then take a look at the .h files that are either in the library's root folder or the src subfolder.
The second option is to use the Arduino Web Editor's sketch metadata system to associate the specific version of the library you want with the sketch:
- From the menu on the left side of the Arduino Web Editor window, click "Libraries".
- Click the Library Manager button.
- Search for "adafruit SSD1306".
- If the star to the right of the library is not already filled, click the star to add the library to your "Favorites".
- Click the Done button.
- From the Libraries pane of the Arduino Web Editor window, click the "Favorites" tab.
- Find "Adafruit SSD1306" in the list of favorite libraries and hover the mouse pointer over "Adafruit SSD1306".
- Click the downward pointing triangle on the right side of the Include button.
- Click "Version 2.2.1"
This will cause the sketch you had open at the time to always use version 2.2.1 of the "Adafruit SSD1306" library.
This is a sketch-specific association, so you need to repeat this process with each sketch you want to associate the library with.
You may want to occasionally check to see if Adafruit has released a new version of the library and repeat the process with the new version selected in order to take advantage of any improvements or bug fixes that have been made to the library in the new release.
This solution will only work for libraries that have had at least two releases. When there is only a single release, Arduino Web Editor doesn't give the option of associating a specific release with the sketch.
The third option is to import the library you want to use. Imported libraries are given preference over the pre-installed libraries.
- From the menu on the left side of the Arduino Web Editor window, click "Libraries".
- Click the Library Manager button.
- Search for "adafruit SSD1306".
- If the star to the right of the library is not already filled, click the star to add the library to your "Favorites".
- Click the Done button.
- From the Libraries pane of the Arduino Web Editor window, click the "Favorites" tab.
- Find "Adafruit SSD1306" in the list of favorite libraries and hover the mouse pointer over "Adafruit SSD1306".
- Click the downward pointing triangle to the right of "Adafruit SSD1306".
- Click "Download Library".
- Click the upward pointing arrow button ("Import") to the right side of the Library Manager button.
- If you get a popup about importing your sketchbook, click the Import button.
- Select the downloaded library (
Adafruit_SSD1306-2.2.1.zip).
- Click the Open button.
- Wait for Arduino Web Editor to display the notification that the library was successfully imported.
- Click the OK button.
This will cause the version of the library you imported to always be used by all sketches (2.2.1 in this case), so you may want to occasionally check to see if Adafruit has released a new version of the library and repeat the process with the new version in order to take advantage of any improvements or bug fixes that have been made to the library in the new release.