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. Development
  3. Message manipulation with set(void* payload, uint8_t length);

Message manipulation with set(void* payload, uint8_t length);

Scheduled Pinned Locked Moved Development
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.
  • F Offline
    F Offline
    feanor-anglin
    wrote on last edited by
    #1

    Just a quick question: any hints/examples on how to use it? I haven't found anything while I'm afraid it can be helpful to me.

    mfalkviddM 1 Reply Last reply
    0
    • F feanor-anglin

      Just a quick question: any hints/examples on how to use it? I haven't found anything while I'm afraid it can be helpful to me.

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

      @feanor-anglin I think set is used in most of the example sketches. One example: https://github.com/mysensors/MySensorsArduinoExamples/blob/bba998bce09bc5139eb4ca7a05b0279f4083ff88/examples/DhtTemperatureAndHumiditySensor/DhtTemperatureAndHumiditySensor.ino#L123

      More: https://github.com/search?q=set+repo%3Amysensors%2FMySensors+path%3Aexamples&type=Code&ref=advsearch&l=&l=

      1 Reply Last reply
      0
      • F Offline
        F Offline
        feanor-anglin
        wrote on last edited by
        #3

        As far as I understand it, there is 10 different set functions for all kinds of payload:
        53d6de50-ad82-4062-865e-c9e5a24604e2-image.png
        Source: https://www.mysensors.org/apidocs/classMyMessage.html

        And now, the set (const void *payload, const size_t length) seems to me as a variant of set function which should give me an ability to create any kind of payload. I see it like this:

        send(message.setType(messageType).setSensor(sensorID).set(payload, length));
        

        So, do I understand it correctly? And if yes, then how to use set (const void *payload, const size_t length) to create any payload, from binary to float?

        mfalkviddM 1 Reply Last reply
        0
        • F feanor-anglin

          As far as I understand it, there is 10 different set functions for all kinds of payload:
          53d6de50-ad82-4062-865e-c9e5a24604e2-image.png
          Source: https://www.mysensors.org/apidocs/classMyMessage.html

          And now, the set (const void *payload, const size_t length) seems to me as a variant of set function which should give me an ability to create any kind of payload. I see it like this:

          send(message.setType(messageType).setSensor(sensorID).set(payload, length));
          

          So, do I understand it correctly? And if yes, then how to use set (const void *payload, const size_t length) to create any payload, from binary to float?

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

          @feanor-anglin thanks for explaining. I don’t think I have seen this particular variant of set used, but I think it works the way you describe it.

          Depending om your use case, you might also be interested in the new multimessage feature.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            feanor-anglin
            wrote on last edited by
            #5

            I've asked, because I cannot test it right now and thought maybe someone has done it before. In this case I will test it myself next week. Right now I have some code that compiles, so maybe it will also work ;)

            Referring to multimessage feature, I don't see any application yet (maybe I need to understand it better). More important to me is auto ID assignment for RS485 which seems to be also finally merged. Great!

            1 Reply Last reply
            0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            14

            Online

            12.0k

            Users

            11.2k

            Topics

            113.4k

            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