I need something like a String


Active member
Good morning

Sometimes I know that I'm still a beginner in programming. I have tested a lot and have searched for a solution. But now I think it's the ti.e to ask the specialists.

I want to extract the VIN from the CAN. I need this VIN in something like a String.

I have 17 variables ( for example: buf[0] to buf[16]). How is it possible to write this variables in one char, string or String???
I need the character like WVW....

After some days of reading testing, I have absolutely no idea.

Thanks a lot.

Note I typically avoid strings, but I believe you can do things like:

char string_buffer[] = "abcdefg";
String my_string = String(string_buffer);

But hard to say what you should do as don't really have any details here.
If you have an array of 17 characters: char buf[17];
And need to print them out, and if the string is NULL terminated (value of 0 after the last character)
You can print the string out like: Serial.print(buf);

If the buffer contains characters and you want to print out a specific number of them, like WVW is the first 3 characters,
you can do something like: Serial.write(buf, 3);

If you wish to output them one at a time, you can do it something like:
Hi KurtE

Thanks for your reply.

I want to show you the following example. The data on the left side are from the CAN. The right side is the ASCII value:

28 31 37 30 32 37 30 59 Y
29 53 32 52 34 58 32 30 S 2 R 4 X 2 0
2A 30 30 31 31 31 31 31 0 0 1 1 1 1 1
2B 35 38 31 39 32 34 30 5 8 1 9 2 4 0

Now I want to have the following String (or an other variable): YS2R4X20001111158