Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By alon24
#13044 I am geting this error (missing SPI.h)
Code: Select allIn file included from ssd1306_128x64_i2c.ino:22:0:
C:\Users\ilan\Documents\Arduino\libraries\Adafruit_SSD1306-master/Adafruit_SSD1306.h:35:17: fatal error: SPI.h: No such file or directory
 #include <SPI.h>
                 ^
compilation terminated.
Error compiling.
User avatar
By alon24
#13430 any news about spi.h?

or any other library for using oled ssd1306?
(I still want to be able to set my pins for i2c in this)?

thanks
User avatar
By Derek
#19175 I searched for hours trying to get this working, and finally got the SSD1306 working with the ESP8266. I have an ESP-07 and was trying to get I2C working on pins 2 and 14.

First, the libraries I used:
https://github.com/somhi/ESP_SSD1306
https://github.com/adafruit/Adafruit-GFX-Library

To stop getting compile errors, add the following line to Adafruit_GFX.cpp:
#elif defined ESP8266 //Added for compatibility with ESP8266 BOARD

also add to glcdfont.c to fix #define PROGMEM nagging on first compile:
#elif defined ESP8266 //Added for compatibility with ESP8266 BOARD
#include <pgmspace.h>

I still wasn't having any success so I scanned the i2c bus using off-the-shelf code, and it found the display. This led me to look into display.begin. What finally got it working was to change in ESP_SSD1306.cpp the line
Wire.begin();
to
Wire.begin(2,14);

And putting SDA/SCL on those pins (It's insufficient to call Wire.begin before or after your display.begin).

To avoid any SPI errors, the SPI library must be included, and in the right order, even though its not used. The right order in your sketch should be:
#include <SPI.h>
#include <Wire.h>
#include <ESP_SSD1306.h>
#include <Adafruit_GFX.h>

Hopefully someone comes up with a longer-term fix to pass pin assignments to the display's begin function, to properly address the issue encountered here.