How to assign static node ID?



  • Gday,

    I have the MQTT Client gateway running and the existing nodes are ok however a new motion sensor node I just built does not seem to be working.

    Could someone let me know how you set a static node ID.

    Regards,
    George


  • Mod

    gw.begin(NULL, 5) sets the node id to 5



  • Ok thanks for that.

    Where should I put that code in the sketch?

    Cheers,


  • Mod

    Replace your current gw.begin



  • I am looking at the development version of the MotionSensor sketch and can not seem to find a gw.begin

    Regards,
    George


  • Hardware Contributor



  • @sundberg84 Fantastic thanks for that it worked perfectly.

    Cheers,
    George


  • Hardware Contributor

    Here are the defines I put in my sketches for the development library:

    //#define MY_NODE_ID 1
    //#define MY_PARENT_ID 0
    
    // Possible values for Arduino IDE: 9600, 19200, 38400, 57600, 74880, 115200, 230400, 250000
    // The last three values are only possible if the mcu works at 16Mhz or more, not possible for 8MHz operation.
    //#define MY_BAUD_RATE 57600
    
    //#define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // Enable serial gateway
    //#define MY_GATEWAY_SERIAL
    
    // Enabled repeater feature for this node
    //#define MY_REPEATER_FEATURE
    
    // Flash leds on rx/tx/err
    //#define MY_LEDS_BLINKING_FEATURE
    // Set blinking period
    //#define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Enable inclusion mode
    //#define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    //#define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    //#define MY_DEFAULT_ERR_LED_PIN 5  // Error led pin
    //#define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN  7  // the PCB, on board LED
    
    // possible values: RF24_PA_LOW (is default on gateway), RF24_PA_MED, RF24_PA_HIGH, RF24_PA_MAX (is default on nodes)
    //#define MY_RF24_PA_LEVEL RF24_PA_HIGH
    
    // RF channel for the sensor net, 0-127. Channel 76 is the default in all library examples
    //#define MY_RF24_CHANNEL     76
    
    //RF24_250KBPS for 250kbs (default), RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
    //#define MY_RF24_DATARATE      RF24_250KBPS
    
    

Log in to reply
 

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