pinMode not declared in current scope

Probably obvious to you guys, but…

in my ILI9341.h file, I have:

#define tftrspin    C1

In my ILI9341.cpp file, I have:

 pinMode(tftrspin,OUTPUT);

And the compiler complains about C1, pinMode and OUTPUT not being declared in current scope.

(I’m using a appropriated Macintosh, not my windoze pc.)

In a .cpp file, you must add:

#include "Particle.h"

it’s transparently added for .ino files, but for .cpp files you need to add it yourself.

If I’m making a library I add it at the top of its .h file.

If you get that error when including a .h file from someone else’s library, include Particle.h before including that library.

2 Likes

Oh! I suspected some subterfuge was going on!

Particle.h