Skip to main content
Rollback to Revision 2
Source Link
Chris Stratton
  • 5.4k
  • 21
  • 40

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

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

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.

added 436 characters in body
Source Link
darimos
  • 13
  • 1
  • 3

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

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.

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

added 293 characters in body
Source Link
darimos
  • 13
  • 1
  • 3

iI have a string like:

String cod="4532, 4488,  548cod=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, 169467,  574";38);

How can iI don't know how to convert it into anthe String to Int Array?

Thanks(rawData) as requested by rsend.sendRaw.

i have a string like

String cod="4532, 4488,  548, 1694,  574";

How can i convert it into an Int Array?

Thanks

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.

Source Link
darimos
  • 13
  • 1
  • 3
Loading