2

I am trying to do some Raw data handling of an IR Remote with Arduino.

unsigned int ArrayKey[68] = {30868,8900,4400,600,500,600,...,600};
irsend.sendRaw(ArrayKey,68,38);

Now I try to get a Raw IR Data via Serial, but there is a syntax problem:

readString is = 30868,8900,4400,600,500,600,1650,600,550,....

unsigned int ArrayKey[68] = {strtok(readString, ",")};

error: cannot convert 'String' to 'char' for argument '1' to 'char* strtok(char*, const char*)'*

1 Answer 1

4

You cannot initialize it like that (non constant, non compatible etc.,), instead you can do it during run time

char *tmp;
int i = 0;
tmp = strtok(readString, ",");
while (tmp) {
   ArrayKey[i++] = atoi(tmp);
   tmp = strtok(NULL, ",");
}
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks but now i got: cannot convert 'String' to 'char*' for argument '1' to 'char* strtok(char*, const char*)' in line: tmp = strtok(readString, ",");
I think your readString is a C++ String, if that is the case try using &readString[0] inside strtok.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.