sending multiple variables to arduino

hey guys :slight_smile: i would like to send 2 variables to my arduino nano.

//C# Project
variable 1 = On/Off
variable 2 = delay time

My arduino receives both variables in one string.
How can I separate the variables with the arduino using serialRead() ?

I just want to tell my arduino to blink. For example: led on, delay time 1000ms

Thank you in advance and sorry for my bad english :stuck_out_tongue:

Best regards, Pete

How can I separate the variables with the arduino using serialRead() ?

You can't separate them using Serial.read(). To do that, you need to collect the data into an array, and then use strtok or sscanf to extract the parts of interest.

ahh, can i use a separator like a "#" and then use split("#") in my arduino sketch ?

You can use a separator (like ,), but not split.

An example of using strtok:

char array[] = "one, two";

char *token = strtok(array, ",");
// token will be "one"

token = strtok(NULL,"\0"); // Use NULL to keep parsing the same array, and \0 to get the rest
// token will be "two"