working with a buffer /String problem

Setup;
I am using multiple 433mhz transmitters to transmit readings to a single Arduino Uno with a 433mhz rx.
I am using the virtualwire library.
Because i am sending from multiple tx’s, I am using this method of address:
tx#1= “A,” is attached to the front of my data
tx#2= “B,” is attached to the fron of my data

On the rx end, I receive the data in buf(i). I am trying to place buf(i) into a string, read the char before the “,” and then ‘if/then’ through the rest of my program.
however, it is not compiling.

I get error:

Arduino: 1.0.6 (Windows 7), Board: “Arduino Uno”
sketch_dec20a.ino: In function ‘void loop()’:
sketch_dec20a:22: error: ‘buf’ cannot be used as a function

here is my code:

#include <VirtualWire.h>
int i;
char comma;
String address;
char A, B; //my addresses
String package; //my transmitted data
void setup(){
   Serial.begin(9600);
  vw_setup(2000);
  vw_rx_start();
  vw_set_rx_pin(11);
}
void loop(){
  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  if( vw_get_message(buf, &buflen) )
      
  
     {   
      for (i = 0; i < buflen; i++)
               { 
  package =( buf(i));             
    
comma=package.indexOf(','); //pull the A,B, whatever from the package
address=(package.substring(0,comma)); // name it address
package = package.substring(comma+1, package.length()); // pass on the rest of my data for use later!

if (comma==A); // I am a tank level
{           Serial.print("TANK LEVEL=  ");               
            Serial.print(package);           
               Serial.print("%");
           Serial.println(" ");

     }
  if (comma==B); // I am a temperature
     {/* serial print other stuff */}
    
          }
     }
}

I am not quite sure HOW to google search this problem!
Ken

  package =( buf(i));

Array indexes go in []. Function arguments go in (). They are NOT interchangeable.

My bad! (fat fingers!) However, when I changed it to:

package =(buf[i]);

I get an ambiguous overload error. So, after some searching on stack overflow, i tried;

package=((const char *)buf[i]);

it compiles.... not sure if it will work though! Thanks!

I am struggling with type casting.
my transmitted data is stored in a buffer as type unit8_t.
String class uses type char.
so, I have been looking at how to convert one to the other. I think the above code does it.

blcodemonkey: I am using multiple 433mhz transmitters to transmit readings to a single Arduino Uno with a 433mhz rx.

Does the single (master) Arduino request data one at a time from the multiple (slave) Arduinos or do they all transmit willy-nilly with the risk of data collisions?

...R

not willy-nilly, but no, the master does not call out, either. Each one will have a set schedule for updating. However, a few sensors are alarms, which could be sent at any time. hence the ID's. Also, my packages will be smaller and consume less energy without an rx also attached and running. Collisions COULD happen at some point, however, it is not too likely!lol (famous last words)