I’m having trouble working with the Adafruit libraries for their OLED displays. The library (SSD1306) is in the library catalog, but the one in the catalog is configured for a different display than the one I have. In the adafruit_SSD1306.h file, there’s the following:
#define SSD1306_128_64
// #define SSD1306_128_32
// #define SSD1306_96_16
I’m using the 128 x 32 display, so I need to comment out the #define SSD1306_128_64 and uncomment out the #define SSD1306_128_32. Not a big deal, but it kinda makes it hard to use the library. To get this to work, as I understand it, I have to fork the library to my GitHub account, make the changes then import the forked library into the web IDE.
This isn’t easy to do mind you, I’ve got to fork it, then change the folder structure AND make a spark.json file, right? But I got it done albeit with some mishaps.
Anyway, with this library in place, I can’t get the sample code from Adafruit to compile. Apparently there are other libraries used by this library. When I try to compile, I get all sorts of errors,
First of all, during verify I get an error that WProgram.h cannot be found, turns out the culprit is this code:
#if ARDUINO >= 100
#include “Arduino.h”
#define WIRE_WRITE Wire.write
#else
#include “WProgram.h”
#define WIRE_WRITE Wire.send
#endif
I found something online that said I need to replace the WProgram.h with:
#include “application.h”
so I’ve done that and gotten around that particular error. Next, I’m getting an:
Adafruit_SSD1306/Adafruit_SSD1306.h:36:17: fatal error: SPI.h: No such file or directory
#include <SPI.h>
I can’t find that file anywhere in the Adafruit code, so I don’t know what to do with this.
What exactly should I be doing to get the Adafruit libraries working in my app? I’ve searched and I can’t find any reference to how to hack these libraries to make them work with the Photon and I could really use your help.