Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Super simple node to node, why doesn't it work?

Super simple node to node, why doesn't it work?

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 2 Posters 1.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Mark SwiftM Offline
    Mark SwiftM Offline
    Mark Swift
    wrote on last edited by
    #1

    Hi Guys,

    I'm trying to make a relay switch on and off with this simple code:

    /*
      REVISION HISTORY
      Created by Mark Swift
      V1.0 - Initial release.
    */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    #define MY_NODE_ID 5
    // #define MY_PARENT_NODE_ID 0 // AUTO
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // Set RF24L01+ channel number
    // #define MY_RF24_CHANNEL 125
    
    // For crappy PA+LNA module
    // #define MY_RF24_PA_LEVEL RF24_PA_LOW
    
    // Enable repeater functionality for this node
    // #define MY_REPEATER_FEATURE
    
    // Include additional libraries
    #include <SPI.h>
    #include <MySensor.h>
    
    void setup()
    {
    }
    
    void loop()
    {
      send(MyMessage(1,V_LIGHT).setDestination(4).set(0));
      delay(2000);
      send(MyMessage(1,V_LIGHT).setDestination(4).set(1));
      delay(2000);
    }
    

    It seems to switch the relay off, but not on, what am I doing wrong?

    Mark

    1 Reply Last reply
    0
    • Mark SwiftM Offline
      Mark SwiftM Offline
      Mark Swift
      wrote on last edited by Mark Swift
      #2

      Okay, I fixed it by changing the 0 / 1 to true / false, didn't realise the relay looked for a boolean!

      On another note, as this node has no sensors, does it matter what is specified in the send message as the CHILD_ID? Seems irrelevant, or am I missing something?

      Edit, Figured it out, the relay example doesn't check what sensor the inbound message is for, but I presume it's better to use the right ID!

      1 Reply Last reply
      0
      • hekH Offline
        hekH Offline
        hek
        Admin
        wrote on last edited by
        #3

        @Mark-Swift said:

        Edit, Figured it out, the relay example doesn't check what sensor the inbound message is for, but I presume it's better to use the right ID!

        Yes.

        Mark SwiftM 1 Reply Last reply
        0
        • hekH hek

          @Mark-Swift said:

          Edit, Figured it out, the relay example doesn't check what sensor the inbound message is for, but I presume it's better to use the right ID!

          Yes.

          Mark SwiftM Offline
          Mark SwiftM Offline
          Mark Swift
          wrote on last edited by
          #4

          @hek A man of many words, huh? :)

          1 Reply Last reply
          0
          • hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by
            #5

            No

            ;)

            1 Reply Last reply
            1
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            25

            Online

            11.7k

            Users

            11.2k

            Topics

            113.1k

            Posts


            Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • MySensors
            • OpenHardware.io
            • Categories
            • Recent
            • Tags
            • Popular