Go Down

Topic: Creating own library, how to import SPI.... (Read 1 time) previous topic - next topic

winneymj

Hi,
I am developing my own library which uses the SPI interface.  When I had all the library code in my sketch it compiled fine.
I decided to move the sketch code to a library and have created the appropriate folder,cpp,h files under the Libraries folder.

My library cpp file includes at the top


#include <SPI.h>

But when I try to compile my sketch that uses the new library I the following error:


error: SPI.h: No such file or directory


error from the library cpp file.

I know if I include <SPI.h> at the top of the sketch it and remove from the library I get a different error:

error: 'SPI' was not declared in this scope


How do I import the SPI library into my own library?

Any help is appreciated
Thanks

Coding Badly


PaulS

Quote
I know if I include <SPI.h> at the top of the sketch it and remove from the library I get a different error

The SPI.h file needs to be included in the source file AND the sketch. It is not an either/or proposition.

Go Up