I've a little problem, I'm trying to create a library with processor variables for tune it.
So in .ino
I declared my preprocessor var, but preprocessor variables appear not defined in my library. (Notice that I've create a folder test/test.h
in libraries
directory of Arduino IDE)
Some code to reproduce the problem :
test.ino :
#define TEST
#include "test.h"
void setup() {}
void loop() {}
test.h (edited, reverse error message, this is solution)
#if defined(TEST)
#error "DEFINED"
#else
#error "NOT DEFINED"
#endif
If I compile it, I fall on #error "NOT DEFINED"
.
Somebody with an idea ?
Have a good day
2 Answers 2
The code is working properly. You have mixed up your error messages. The code should be:
#if defined(TEST)
#error "DEFINED"
#else
#error "NOT DEFINED"
#endif
UPDATE: The question was edited after the time of this answer to correct the mixed up error messages.
Please, start by reading the Writing a Library for Arduino Tutorial. That will solve your question.
Explore related questions
See similar questions with these tags.
#define TEST (1)
?