How to pass the #define for MySensors

  • I need to use the same technique in my library but is not working.
    I am using in my config.h

    #ifdef ODEV_API_KEY
    #ifndef ODEV_API_KEY
    #define ODEV_API_KEY_REAL "*"
    const char MQTT_TOPIC[] = ODEV_API_KEY_REAL "/in/ModuleName";

    If I put a #error at first condiftion, it really indicates is falling in this first condition, but MQTT_TOPIC is as if he had fallen in second

  • Admin

    The "trick" we use in the mysensors library is to include code files (cpp) in the MySensors.h header file. A bit ugly but as the Arduino IDE has a very limited build system, it's the only way you can make defines in sketch visible in the code.

  • If I knew it could include cpf in a .h file I had done before ... =]
    Thanks for the tip.

  • I have found some alternatives that can be used:

Log in to reply

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.