SPI.h for adafruit 16x8 Led Matrix

I am trying to play with an Adafruit 16x8 Led Matrix. But when I try to compile an example program, I get the following error message:

In file included from .pio\libdeps\uno\Adafruit GFX Library_ID13\Adafruit_SPITFT.cpp:36:0:
.pio\libdeps\uno\Adafruit GFX Library_ID13\Adafruit_SPITFT.h:26:17: fatal error: SPI.h: No such file or directory

I am gathering that SPI.h is another Library that I need to include with in my project along with the Adafruit GFX Library and the Adafruit LED Backpack Library.

When I search for the SPI.h library, I get a bunch of hits, but none of the library’s seem to be for i2c communication with the Adafruit Led Backpack.

What am I missing?

Hm, looks like PlatformIO doesn’t like something about the conditional compliation stuff Adafruit used there…

Anyway, you can either add …

lib_ldf_mode = deep

to your platformio.ini

– OR –

Put the following at the top of your main.cpp file

#include <Arduino.h>
#include <SPI.h>

Either of which will make it go away, as SPI is a built-in library, part of the Arduino core, but for some reason the way it’s being called by the Adafruit GFX Library isn’t working properly with PlatformIO’s library system.

1 Like

Thank You!

Adding #include <SPI.h> to the top of my main.cpp file did the trick.

3 Likes