Splitting Telemery Data sent via Virtualwire

Hi all,
I have been trying to split data received from my RC Car that uses an Arduino to Transmit Sensor Data.

The sensor data consist of a Sensor ID and a the reading.
Example:- Light:12,Temp:12

Has anyone got any pointers on how I can split the data?

My Goal is to add an Arduino & LCD Screen to my RC Controller

Thanks in advance

DLAr

Search the forum and thou will find - http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1226107230

Should get you started

Thank for the response,

I have looked @ that code, however its not quite what I'm looking for!

I need a code that will search a string "Light:" and take the next two characters and store them as an int value "12".

Thanks again

DLAr

Thats right, the code presented there splits a string in the words it makes up. So if you find light you know you have to take the next word.

Light:12,Temp:12

You need to split your string first in records [ light:12 ] [ Temp: 12 ] The , is the record separator
And then the records into fields [[ Light ] [12] ] [[Temp ][ 12 ]] The : is the field separator

If you don't want to use strTok() you can write a function that searches for a word in a string and returns its position

Something like this (not tested)

int strIndex(char* str, char* word)
{
  for (int i = 0; i< strlen(str) - strlen(word); i++)
  {
    if strncmp(str+i, word, strlen(word)) ==0) return i;
  }
  return -1;
}

The problem with the latter approach is that you will never be sure how long the field is that comes after light: That can be 1 digit, 2 digits or maybe 3 digits or ...
The first method is more robust as it splits the string based upon the separators.

Succes,
Rob

Thats what i was thinking robtillaart!

To get around that, I was thinking or scaling the readings to within a 000 - 100. That way I can guarantee that the transmitted reading will only be 3 digits long.

I found this from http://code.google.com/p/ardu-station/:

latitude=Search_Int(buffer,"LAT:");//Searching for the string LAT:, and converting/storing the value next to it. 

int Search_Int(char buffer[],char looking[])
{
  char *BufferPointer=buffer;
  char *SearchString;
  SearchString= strstr (BufferPointer,looking); 
  return atoi(SearchString+4);
}

The problem is when I try to adapt it to my code I get errors about Virtualwire using uint8_t.

how can I convert uint8_t to char?

Thanks

DLAr