like i said, i had it working with a char array:
void serialEvent()
{
if(Serial.available() >17)
{
Serial.readBytesUntil('\n',input, 18)
}
for(int i = 0; i <18; i++)
{
Serial.write(input[i]);
}
}
which worked fine for returning the data i sent to the arduino.
I also preffer arrays, and the code in which i used the string is another test.
The problem is that i want to drive a servo with the data i get from my pc.
I tried using this code to get the values split up, but this wouldnt work for me:
char *p = input;
char *str;
Serial.begin(115200);
while ((str = strtok_r(p, ",", &p)) != '\n') // delimiter is the semicolon
{
value[z] = *str;
z++;
p = NULL;
}
any ideas?