I have a string:
String cod=server.arg("codice");
where codice (an IR sequence) is retrieved from a webserver. For example:
codice=1, 2, 3, 4
In which the syntax can be modified.
So, cod is a string that contains numbers separated with ", "
To send the IR code i use:
irsend.sendRaw(rawData, 67, 38);
I don't know how to convert the String to Int (rawData) as requested by rsend.sendRaw.
SOLVED:
String cod = "1, 2, 3, 4, 5";
const size_t bufferSize = 5;
uint16_t arr[bufferSize];
char *str = (char*)cod.c_str();
size_t index = 0;
while (p != nullptr && index < bufferSize) {
arr[index++] = atoi(p);
p = strtok(NULL, ",");
}
for (size_t i = 0; i < index; i++)
Serial.println(arr[i]);
irsend.sendRaw(arr, 5, 38);
i forgot that irsend accepts uint16_t