Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples fail to build under platformio - Missing SPI.h #273

Open
italocjs opened this issue Jan 30, 2023 · 1 comment
Open

Examples fail to build under platformio - Missing SPI.h #273

italocjs opened this issue Jan 30, 2023 · 1 comment

Comments

@italocjs
Copy link

  • board: ESP32WROOM32
  • IDE: Platformio 1.74.3 + Arduino Framework

The example fails to build because SPI.h is not found, as the following messages indicate

In file included from .pio/libdeps/esp32dev/Adafruit BusIO/Adafruit_BusIO_Register.h:10,
                 from .pio/libdeps/esp32dev/Adafruit BusIO/Adafruit_BusIO_Register.cpp:1:
.pio/libdeps/esp32dev/Adafruit BusIO/Adafruit_SPIDevice.h:9:10: fatal error: SPI.h: No such file or directory

Platformio suggest to include another library using its dependencies, but SPI is already part of the framwork, to fix the error the user just need to include SPI before the rest of the example code.

Example:

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

// Date and time functions using a PCF8563 RTC connected via I2C and Wire lib
#include "RTClib.h"
RTC_PCF8563 rtc;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
~rest of example

Maybe adding this tip, as a comment on the example can help other users to avoid this error.

@AVLChris
Copy link

I've found that if you add "SPI" in your platformio.ini file it takes care of the issue.

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps = 
	SPI
	adafruit/RTClib@^2.1.1
	arduino-libraries/NTPClient@^3.2.1
	adafruit/Adafruit BusIO@^1.14.1
monitor_speed = 115200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants