Thanks, I did just stumbled upon something likewise and tried it:
#include <string.h>
char *data;
char delimiters[] = ",";
char *a;
char *b;
char *c;
char *d;
void setup()
{
Serial.begin(9600);
}
void loop()
{
char anemometer[] = "$IIMWV,225.0,R,000.0,N,A*38";
a = strtok(anemometer, delimiters);
b = strtok(NULL, delimiters);
c = strtok(NULL, delimiters);
d = strtok(NULL, delimiters);
{
delay(500);
Serial.println(a);
Serial.println(b);
Serial.println(c);
Serial.println(d);
data = strtok(NULL, delimiters);
}
delay(1000);
}
But I will try it your way (it looks quite the same). And now I finally understand the strtok function totally. And indeed, I did meant float
, srry about that.
Thanks again!