I'm trying to write a generic "Test Bench" type of sketch using booleans to indicate whether or not to include specific libraries. After those are defined, I'm attempting to use preprocessor #if statements to determine if the libraries need to be included and create the objects if need be.
Example:
const bool useLCD = true;
...
#if (useLCD)
#include "NHD_4x20.h"
NHD_4x20 lcd(9);
#endif
These statements are before the setup() and loop() functions. This in itself doesn't generate compiler errors, however I get "lcd has not been defined in this scope" when trying to use the object in the setup() and loop() functions.
Is there some simple trick to accomplish this that I'm overlooking here ?
Thanks in advance !