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. Sending a string in send() - not doing as I want it to do

Sending a string in send() - not doing as I want it to do

Scheduled Pinned Locked Moved Troubleshooting
7 Posts 2 Posters 1.4k Views 1 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.
  • M Offline
    M Offline
    mickecarlsson
    wrote on last edited by
    #1

    Hi,
    I have this function in my sketch:

    void CheckRSSI()
    {
      char SendingRSSI[10];
      char ReceivingRSSI[10];
      char TxPowerLevel[10];
      char TxPowerPercent[10];
      String sendRSSI;
      itoa(RFM69_getSendingRSSI(), SendingRSSI,10);
      wait(200); 
      itoa(RFM69_getReceivingRSSI(), ReceivingRSSI,10);
      wait(200); 
      itoa(RFM69_getTxPowerLevel(), TxPowerLevel,10);
      wait(200); 
      itoa(RFM69_getTxPowerPercent(), TxPowerPercent,10);
      wait(200); 
      // Now, combine all values and send it in
      // Line should look like "T:-90 R:-81 PL:20 PP:100"
      sendRSSI = "T: ";
      sendRSSI.concat(SendingRSSI);
      sendRSSI.concat(" R:");
      sendRSSI.concat(ReceivingRSSI);
      sendRSSI.concat(" PL:");
      sendRSSI.concat(TxPowerLevel);
      sendRSSI.concat(" PP:");
      sendRSSI.concat(TxPowerPercent);
    #ifdef MY_DEBUG
      Serial.print(F("RSSI String: ")); 
      Serial.println(sendRSSI); 
    #endif
      send(msgRSSI.set(sendRSSI));
    }
    

    The output is:

    RSSI String: T: -59 R:-51 PL:-2 PP:0
    TSF:MSG:SEND,13-13-0-0,s=1,c=1,t=47,pt=0,l=23,sg=0,ft=0,st=1
    

    Why does send() only send 1 instead of the string?
    Using 2.2.0-rc.1

    mfalkviddM 1 Reply Last reply
    0
    • M mickecarlsson

      Hi,
      I have this function in my sketch:

      void CheckRSSI()
      {
        char SendingRSSI[10];
        char ReceivingRSSI[10];
        char TxPowerLevel[10];
        char TxPowerPercent[10];
        String sendRSSI;
        itoa(RFM69_getSendingRSSI(), SendingRSSI,10);
        wait(200); 
        itoa(RFM69_getReceivingRSSI(), ReceivingRSSI,10);
        wait(200); 
        itoa(RFM69_getTxPowerLevel(), TxPowerLevel,10);
        wait(200); 
        itoa(RFM69_getTxPowerPercent(), TxPowerPercent,10);
        wait(200); 
        // Now, combine all values and send it in
        // Line should look like "T:-90 R:-81 PL:20 PP:100"
        sendRSSI = "T: ";
        sendRSSI.concat(SendingRSSI);
        sendRSSI.concat(" R:");
        sendRSSI.concat(ReceivingRSSI);
        sendRSSI.concat(" PL:");
        sendRSSI.concat(TxPowerLevel);
        sendRSSI.concat(" PP:");
        sendRSSI.concat(TxPowerPercent);
      #ifdef MY_DEBUG
        Serial.print(F("RSSI String: ")); 
        Serial.println(sendRSSI); 
      #endif
        send(msgRSSI.set(sendRSSI));
      }
      

      The output is:

      RSSI String: T: -59 R:-51 PL:-2 PP:0
      TSF:MSG:SEND,13-13-0-0,s=1,c=1,t=47,pt=0,l=23,sg=0,ft=0,st=1
      

      Why does send() only send 1 instead of the string?
      Using 2.2.0-rc.1

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

      How is msgRSSI created?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mickecarlsson
        wrote on last edited by
        #3
        // Debug
        #define MY_DEBUG
        // Enable and select radio type attached
        #define   MY_RADIO_RFM69
        #define   MY_IS_RFM69HW
        #define   MY_RFM69_NEW_DRIVER
        #define   MY_RFM69_FREQUENCY RFM69_868MHZ
        // #define   MY_RFM69_ENABLE_ENCRYPTION
        
        #include <MySensors.h>
        
        #define SKETCH_NAME    "Test-text"
        #define SKETCH_VERSION "1.0"
        
        #define CHILD_ID_RSSI_INFO  1
        
        // Mysensors settings
        MyMessage msgRSSI(CHILD_ID_RSSI_INFO, V_TEXT);
        
        void before()
        {
        }
        
        void setup()
        {
          Serial.begin(115200); // for serial debugging.
          Serial.println(F("Start up sensor."));
        }
        
        void presentation()
        {
          present(CHILD_ID_RSSI_INFO, S_INFO, "RSSI Info");
        }
        
        void loop()
        {
        #ifdef MY_DEBUG
          Serial.println(F("Starting new measurements"));
        #endif
          CheckRSSI();
          // Sleep 
        #ifdef MY_DEBUG
          Serial.println(F("Waiting 1 minute"));
        #endif
          wait(60000);
        }
        
        
        
        mfalkviddM 2 Replies Last reply
        1
        • M mickecarlsson
          // Debug
          #define MY_DEBUG
          // Enable and select radio type attached
          #define   MY_RADIO_RFM69
          #define   MY_IS_RFM69HW
          #define   MY_RFM69_NEW_DRIVER
          #define   MY_RFM69_FREQUENCY RFM69_868MHZ
          // #define   MY_RFM69_ENABLE_ENCRYPTION
          
          #include <MySensors.h>
          
          #define SKETCH_NAME    "Test-text"
          #define SKETCH_VERSION "1.0"
          
          #define CHILD_ID_RSSI_INFO  1
          
          // Mysensors settings
          MyMessage msgRSSI(CHILD_ID_RSSI_INFO, V_TEXT);
          
          void before()
          {
          }
          
          void setup()
          {
            Serial.begin(115200); // for serial debugging.
            Serial.println(F("Start up sensor."));
          }
          
          void presentation()
          {
            present(CHILD_ID_RSSI_INFO, S_INFO, "RSSI Info");
          }
          
          void loop()
          {
          #ifdef MY_DEBUG
            Serial.println(F("Starting new measurements"));
          #endif
            CheckRSSI();
            // Sleep 
          #ifdef MY_DEBUG
            Serial.println(F("Waiting 1 minute"));
          #endif
            wait(60000);
          }
          
          
          
          mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by mfalkvidd
          #4

          @mickecarlsson sendSketchInfo is missing. Not sure if that affects anything.

          The presentation call is strange. I haven't seen it used with three paramters before.
          Edit: seems to be my inexperience, so presentation is probably ok.

          1 Reply Last reply
          0
          • M mickecarlsson
            // Debug
            #define MY_DEBUG
            // Enable and select radio type attached
            #define   MY_RADIO_RFM69
            #define   MY_IS_RFM69HW
            #define   MY_RFM69_NEW_DRIVER
            #define   MY_RFM69_FREQUENCY RFM69_868MHZ
            // #define   MY_RFM69_ENABLE_ENCRYPTION
            
            #include <MySensors.h>
            
            #define SKETCH_NAME    "Test-text"
            #define SKETCH_VERSION "1.0"
            
            #define CHILD_ID_RSSI_INFO  1
            
            // Mysensors settings
            MyMessage msgRSSI(CHILD_ID_RSSI_INFO, V_TEXT);
            
            void before()
            {
            }
            
            void setup()
            {
              Serial.begin(115200); // for serial debugging.
              Serial.println(F("Start up sensor."));
            }
            
            void presentation()
            {
              present(CHILD_ID_RSSI_INFO, S_INFO, "RSSI Info");
            }
            
            void loop()
            {
            #ifdef MY_DEBUG
              Serial.println(F("Starting new measurements"));
            #endif
              CheckRSSI();
              // Sleep 
            #ifdef MY_DEBUG
              Serial.println(F("Waiting 1 minute"));
            #endif
              wait(60000);
            }
            
            
            
            mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #5

            @mickecarlsson see if changing

              send(msgRSSI.set(sendRSSI));
            

            to

              send(msgRSSI.set(sendRSSI.c_str()));
            

            helps

            1 Reply Last reply
            1
            • M Offline
              M Offline
              mickecarlsson
              wrote on last edited by
              #6

              THANKS!!
              That did it:

              RSSI String: T: 127 R:-49 PL:-2 PP:0
              TSF:MSG:SEND,13-13-0-0,s=1,c=1,t=47,pt=0,l=23,sg=0,ft=0,st=OK:T: 127 R:-49 PL:-2 PP:0
              
              mfalkviddM 1 Reply Last reply
              1
              • M mickecarlsson

                THANKS!!
                That did it:

                RSSI String: T: 127 R:-49 PL:-2 PP:0
                TSF:MSG:SEND,13-13-0-0,s=1,c=1,t=47,pt=0,l=23,sg=0,ft=0,st=OK:T: 127 R:-49 PL:-2 PP:0
                
                mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by
                #7

                @mickecarlsson great!

                1 Reply Last reply
                1

                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


                11

                Online

                12.1k

                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