Hi,
I thought that a #define statement was supposed to be global to a whole project, or is this not the case?
Here's what I'm doing to test.
Firstly I put this as the very first line in my .ino file....
#define BANANA
Then in the setup phase of the .ino file I add this.....
#ifdef BANANA
Serial.println("banana");
#else
Serial.println("no banana");
#endif
The sketch compiles and uploads fine, when it runs I see the message 'banana'. all working as expected up to this point.
I then add a very similar statement to one of my functions inside a library of mine...
#ifdef BANANA
Serial.println("more bananas");
#else
Serial.println("no more bananas");
#endif
note - the library is #include'd in the .ino file after the line '#define BANANA'
This compiles and uploads ok, but now I get the additional printout 'no more bananas'
I thought that a #define statement was valid from that point forward, so putting it right at the top of the .ino file (specifically before the #include of the library that it's used in) would mean it should be visible inside that library. Or have I misunderstood something?
thanks