As usual I have managed to solve some problems while failing to solve others. Currently I am stuck on the translation of data. I am building a cheap tranceiver using radio transmitters and receivers I have got from Sparkfun. I am able to send an address and receive the addresses of others transmitting theirs.
The trick I am trying to pull off in the larger view is that I want to also send which tranceivers each individual tranceiver can see. I am able to send the data from variables as follows- 0:1,2 where 0 is the tranceiver that can see 1 and 2. However, currently the 1 and 2 is only hard coded not a variable like the address.
I am having trouble parsing the uint8_t data that I receive. I have worked out a script to translate a string to integers with , delineation. However I cannot get the uint8_t data to convert to a char so that i can strcat it into a string for parsing into int's.
here is the script where it needs to go.
char msg[30]="";
///////////////////////////////////////////Receive Data
void rx(){
// vw_rx_start();
// Serial.println("Receive");//Debug Only
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
vw_wait_rx();
if (vw_get_message(buf, &buflen)) // check to see if anything has been received
{
for (int i=0;i<buflen;i++) msg[i]=0;
int i;
// Message with a good checksum received.
Serial.print("Got: ");
for (int i = 0; i < buflen; i++)
{
Serial.print(buf[i], BYTE);
msg[i]=buf[i];
}
Serial.println();
}
}
I have tried many things (removed because they failed). Typically the error is either cannot convert uint8_t to const *char or cannot convert char to *char.
What is the proper method for parsing uint8_t to char. So far I can print the msg
var but cannot do anything useful with it.
Thanks