String via serial read and split

I use a code from the forum and it works perfectly. The code splits a 16-digit code at “:” and outputs the two parts separately.

#include <stdio.h>
#include <string.h>
void setup()
{
  Serial.begin(9600);
 // while (Serial.available() > 0) {
    char* value =  "AAAA1234:BBBB0987";
    char* token = strtok(value, ":");
    char* te = token;
    token = strtok(0, ",");
    char* tz = token;
    token = strtok(0, ",");

    Serial.println(te);
    Serial.println(tz);

  }


void loop()
{
}

(Te) and (tz) are to be output on a LCD display in 2 rows later. I would like that I can read the data from the serial interface and split.

But with this attempt I get an error

#include <stdio.h>
#include <string.h>
void setup()
{
  Serial.begin(9600);
  while (Serial.available() > 0) {
     delay(100);
   char* value =  Serial.read();
    char* token = strtok(value, ":");
    char* te = token;
    token = strtok(0, ",");
    char* tz = token;
    token = strtok(0, ",");

    Serial.println(te);
    Serial.println(tz);

  }


void loop()
{
}

The error comes at char* value = Serial.read();

invalid conversion from ‘int’ to ‘char*’ [-fpermissive]
Arduino: 1.6.4 (Windows 7), Platine: “Arduino Uno”

StringZerlegen.ino: In function ‘void setup()’:
StringZerlegen.ino:8:32: error: invalid conversion from ‘int’ to ‘char*’ [-fpermissive]
StringZerlegen.ino:22:1: error: a function-definition is not allowed here before ‘{’ token
StringZerlegen.ino:23:1: error: expected ‘}’ at end of input
invalid conversion from ‘int’ to ‘char*’ [-fpermissive]

Where is my mistake? How can I solve this?

Did you mean   char value =  Serial.read();(hint)

Thank you for your quick response. The original code, which works perfectly, stands char* value. If I do instead char value the error is in the next line. If I replace all char* I get an error in "char token = strtok(value, ":");"

StringZerlegen.ino: In function 'void setup()': StringZerlegen.ino:9:35: error: invalid conversion from 'char' to 'char*' [-fpermissive]

Problem solved. Since the string to be split always has exactly 16 characters, I could solve it with SubSstring.

|500x375

Since the string to be split always has exactly 16 characters, I could solve it with SubSstring.

What a load of rubbish. char * does NOT have a SubString() method. Nor does the String class that you should NOT be using.

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example.

...R