Message.GetString() Error



  • Hello,

    I have a problem with the Message.GetString() function.
    I send a RGB value in HEX format to the node and when reading out the message content I get a strange behavior.

    The serial console tells me the following

    read: 0-0-16 s=0,c=1,t=40,pt=0,l=6,sg=0:FF9A00
    

    But when I try to read the message value I get:

    HEX: FF9A00de
    

    In the code I do the following:

    String hexstring = message.getString(); //here goes the hex color code coming from through MySensors (like FF9A00)
    Serial.print("HEX: "); Serial.println(hexstring);
    

    I don't think that this is an issue of the controller or the Arduino sketch.

    does somebody have an idea how to solve this?

    Thanks.
    Stefan


  • Hardware Contributor

    Hi Stefan!
    Which version do you run? We had an issue in early 1.6 which has been solved.
    If you run 1.6 this will go away if you download latest 2.0



  • Currently I am using the latest stable version from the website:

    link text

    Should be version 1.5

    Do I need to do any changes in the controller, when I'm using the 2.0 version?
    Do I need to update the gateway as well?

    I'm right that the development tree is the version 2.0 you are talking about?


  • Hardware Contributor

    I dont think this was an issue in 1.5.... hmm, sorry - cant help you then. I hope someone else knows.



  • I did now include a

    hexstring.substring(0,6)
    

    To only get the first 6 characters.



  • This post is deleted!

  • Admin

    Use:

    char *hextstring =  message.getString();
    

    Even though it's called getString we actually not use the String class (which isn't recommended to use on these small embedded systems)


Log in to reply
 

Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts