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. General Discussion
  3. receive message...

receive message...

Scheduled Pinned Locked Moved General Discussion
6 Posts 3 Posters 3.4k Views 3 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.
  • TmasterT Offline
    TmasterT Offline
    Tmaster
    wrote on last edited by Tmaster
    #1

    Hello . on led rgb controller or relay exemples,if you want receive a message from controller part of the code is that one :

    
    
    void receive(const MyMessage &message)
    {
      //When receiving a V_STATUS command, switch the light between OFF
      //and the last received dimmer value  
      if ( message.type == V_STATUS ) {
        Serial.println( "V_STATUS command received..." );
    

    My Question is ; if i have 2 diferent relay nodes or rgb controller nodes ,how this simple "if MESSAGE IS V_STATUS or V_LIGHT " define what node refers to?

    i mean how to select with one i want to switch on or off?

    i'm a arduino fan .Even sometimes don't undestanding how to use it :P

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

      Node is same. But sensor may differ. You'll find sensor number in message.sensor.

      1 Reply Last reply
      0
      • TmasterT Offline
        TmasterT Offline
        Tmaster
        wrote on last edited by Tmaster
        #3

        so the problem of try turn one sensor on and turn the other will not exist because its already on message core?

        sory about this question but in not good on code as i am on eletronics and i dont know /understand yet all the api

        i'm a arduino fan .Even sometimes don't undestanding how to use it :P

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

          Sorry, I don't understand the question.

          1 Reply Last reply
          0
          • TmasterT Offline
            TmasterT Offline
            Tmaster
            wrote on last edited by Tmaster
            #5

            imagine i have 2 diferent arduinos with relays. i will upload the same code for both, exept the node_id .

            then i want turn node 1 on. gw send message "to the air" and both arduino get message saying "light on"

            what i can't understand yet is ,that part of code only says ; if message is v_light turn on, For example

            where is the part saying only turn relay 1 on?(differ nodes)will both relays turn on? if they have same code(exept de id)?

            i'm a arduino fan .Even sometimes don't undestanding how to use it :P

            mfalkviddM 1 Reply Last reply
            0
            • TmasterT Tmaster

              imagine i have 2 diferent arduinos with relays. i will upload the same code for both, exept the node_id .

              then i want turn node 1 on. gw send message "to the air" and both arduino get message saying "light on"

              what i can't understand yet is ,that part of code only says ; if message is v_light turn on, For example

              where is the part saying only turn relay 1 on?(differ nodes)will both relays turn on? if they have same code(exept de id)?

              mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by
              #6

              @Tmaster a node's receive function will only be called if the message is addressed to that node.

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


              21

              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