Hi, i want to write a code that will turn on the leds based on what do i send via serial communication.
For example, if i send: 3,33,2,44,5 i want to split this string in 5 integers, so i can use them in a loop that will turn on the leds[3]; leds[33]; ....
Hi and welcome to the forum. Please read the forum guide to find out how to post code. If you look closely, the code snippet you posted has been corrupted by the forum. And you should post your code in full. Please modify your post above and fix those things.
Your code does not work, I think, because the strtok() function does not work with Strings. It works with C-strings (char *). On that page is an example of how to use the function correctly.
What kind of Arduino are you using? Use of Strings is not recommended on Arduino with very limited ram memory, like Uno.