invalid operands of types 'String [5]' and 'char [3]' to binary 'operator+'

How do I modify in order to make "11" as an element? like, those 4 elements are separated by the comma.Thats why the char is put in array of 5..

I really have no idea what you are trying to achieve any why you want to get that value back but if you want to get back the 'node' string from the string you just built, you can always you strtok to split the string again using ',' as delimiter.

I've let you got thru the link to make your own code! :wink:

hope that helps....

Ya, I wanted to get the node string back. Because I need RX side to read the value for further process.So I need to convert the chart to string before call the array, am I right?
or is that any way to call the array when it is in char type??

you are dribbling info which is NOT helpful!!!!

just like you are using 'rf95.send', am I right to assume there is a rf95.receive?

I have no I idea how that function works or what is returns but I would assume you either are passing an array to it OR the function returns a point to a c-string.

either case, once you have 'received' your c-string, as previously mentioned, use strtok to split the string and recover your 'node' and 'dest_ID'. (HINT: you can also print out the value of 'i' as you split the string to know the string position)

hope that help...

Alright. Thanks a bunch!!

May I know what is the fifth strings? Because if I call radiopacket [3] now, it shows "," instead of the des_ID, the comma should be ignored and not counted as elements in my case..

As noted in previous replies above you are confusing arrays of Strings with char indexing into one string
So if you want to keep your Strings separate use

String radiopacketParts[] = {"Q ", ",", "node--", ",", "des_ID", ",", "Hello"}; // add extra strings here as needed
const size_t numberOfParts = sizeof(radiopacketParts)/sizeof(radiopacketParts[0]);

void loop() {
 // .  .   .
  String radioPacket;
  for (size_t i=0; i<numberOfParts; i++) {
    radioPacket += radiopacketParts[i];
  }
  Serial.println(radioPacket.c_str());
}

If you are using a lot of Arduino Strings check out my tutorial on Taming Arduino Strings

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.