Sensor ID Code display



  • I use this code header on my project to ID the code in a given device... you might find it useful in your projects...
    I use primarily, Moteino and MoteinoMega or equiv with RFM69 radios on my projects...

    It outputs an hello message to the serial port, with file name, compile date, time, sensor version number and node information

    /*  Enable debug prints to serial monitor on port 0 */
    #define MY_DEBUG            // used by MySensor
    
    #define SKETCHNAME "Water and Pressure Meter"
    #define SKETCHVERSION "1.2c"
    
    #define MY_RFM69_NETWORKID 200   // Network ID, unique to each network, production = 100, test = 200 
    #define MY_NODE_ID 7                            // My Sensor Node ID real = 6, 7 = test  
    
    
    void setup()  
    {  
      // initialize serial communication at 115200bits per second:
      Serial.begin(115200);
    
    #ifdef __AVR_ATmega1284P__      // use for Moteino Mega Note: LED on Mega are 1 = on, 0 = off
      debug(PSTR("** Hello from the Water Meter on a MoteinoMega **\n") );
      #else                         // we must have a Moteino
      debug(PSTR("** Hello from the Water Meter on a Moteino **\n") );
    #endif
    
      const char compile_file[]  = __FILE__ ;
      debug(PSTR(" %s %s\n"), SKETCHNAME, SKETCHVERSION);
      debug(PSTR(" %s \n"), compile_file);
      const char compile_date[]  = __DATE__ ", " __TIME__;
      debug(PSTR(" %s \n\n"), compile_date);
      debug(PSTR(" Network ID: %u  Node ID: %u\n\n"), MY_RFM69_NETWORKID, MY_NODE_ID);
    
    // your code as needed......
    
    }
    

Log in to reply
 

Suggested Topics

12
Online

11.4k
Users

11.1k
Topics

112.7k
Posts