coding issue with IRremoteESP8266

The example IR server part goes like this

[/void handleRoot() {
  server.send(200, "text/html",
              "<html>" \
                "<head><title>ESP8266 Demo</title></head>" \
                "<body>" \
                  "<h1>Hello from ESP8266, you can send NEC encoded IR" \
                      "signals from here!</h1>" \
                  "<p><a href=\"ir?code=16769055\">Send 0xFFE01F</a></p>" \
                  "<p><a href=\"ir?code=16429347\">Send 0xFAB123</a></p>" \
                  "<p><a href=\"ir?code=16771222\">Send 0xFFE896</a></p>" \
                "</body>" \
              "</html>");
}

void handleIr() {
  for (uint8_t i = 0; i < server.args(); i++) {
    if (server.argName(i) == "code") {
      uint32_t code = strtoul(server.arg(i).c_str(), NULL, 10);
      irsend.sendNEC(code, 32);
    }
  }code]

I am using Panasonic which is totally different format 

Irsend.Panasonic(address in hex , code in hex)  like (0x4004,0x0100BCBD)  which works !!!!

my code is like this:
[code]void handleRoot() {
  server.send(200, "text/html",
              "<html>" \
                "<head><title>ESP8266 Demo</title></head>" \
                "<body>" \
                  "<h2>Hello from ESP8266, you can send Panasonic encoded IR" \
                      "signals from here!</h2>" \
                  "<h1><a href=\"ir?code=0x0100bcbd\">Send PowerON</a></h1>" \
                  "<h1><a href=\"ir?code=0x0100bcbd\">Send PowerOff</a></h1>" \
                  "<h1><a href=\"ir?code=0x0100bcbd\">Send VolumeUP</a></h1" \
                "</body>" \
              "</html>");
}

void handleIr() {
  for (uint8_t i = 0; i < server.args(); i++) {
    if (server.argName(i) == "code") {
      String code = strtoul(server.arg(i).c_str(), NULL, 10); // my very amateurish mod. 
      irsend.sendPanasonic(0x4004, code);
    }
  }

To avoid your possible wrong take that it is IRremote issue that needs delving in, It is NOT. It is purely programming issue. Let me expand:

The example code is assuming a numeric field for the code, mine is hex as shown in my version.
This is causing compiling issues of mismatch

The statement irsend.Panasonic(0x4004, 0x0100BCBD); works !!!!! if I do this:

[codevoid handleIr() {
for (uint8_t i = 0; i < server.args(); i++) {
if (server.argName(i) == "code") {
uint32_t code = strtoul(server.arg(i).c_str(), NULL, 10);
irsend.sendPanason(0x4004,0x0100BCBD); // the change I made and it works
}][/code]

I hope you see the problem, and also hope that you agree it is programming problem of data type mismatch

your support will be greatly appreciated

This looks to be sending a string pointer to irsend as code???

String code = strtoul(server.arg(i).c_str(), NULL, 10); // save to string code
irsend.sendPanasonic(0x4004, code); // try to send string pointer to irsend????

This creates code as uint32_t and then sends irsend a binary constant 0x100BCBD.

uint32_t code = strtoul(server.arg(i).c_str(), NULL, 10); //save to unsigned long code
irsend.sendPanason(0x4004,0x0100BCBD); // send fixed value 0x0100BDBD to irsend

Try this one... line 1 from 2nd example and line 2 from 1st example.

uint32_t code = strtoul(server.arg(i).c_str(), NULL, 10); save to uint32_t
irsend.sendPanason(0x4004,code); // send uint32_t value to irsend

What a way to celebrate the new year.....It worked .....
I would like to thank you for making it happen.....C is a bit tricky and I was lost.

I hope you start the new year with the the same happy feeling that you gave me.

These data types in C driving me crazy....
As you have guessed I am emulating my "several" IR remotes to a web browser control.

My next challenge was my Satellite provider (OSN), their remote is using RC6 which is supported by IRremoteEsp8266 library....BUT I cannot do it.

The issue here is the code is 64 bits example 53692770252 and it's length is 36
So,
irsend.sendRC6(code,36)....Again if I do force the line irsend.sendRC6(53692770252,36) It works
But using the same function as before (See above) it does not work. The problem is in handleIr()

I know for a fact that IRremote library handles 64 bits integers but I do not know how to do it !!!!!

Happy Holidays!

Try

unsigned long long code = 53692770252LL;
irsend.sendRC6(code,36);

or

unsigned long long code = stoll(server.arg(i).c_str(), NULL, 11);
irsend.sendRC6(code,36);

I tried the second approach got the error message:

"stoll' was not declared in this scope......I noticed you are using different sub (the original was strtoul) also using 11 instead of 10 ( I thought 10 (the base) indicate decimal

As of the "first" suggestion I do not understand it can you elaborate a bit ...thanks for you patience

I am an "old" IBM'er. And we used to make fun of it (   Immer Besser Manual  )

So, to shy away from c data types ( You know by now how weak I am in this department) here is a solution:

[codevoid handleIr() {
  for (uint8_t i = 0; i < server.args(); i++) {
    if (server.argName(i) == "code") {
    String x =server.arg(i).c_str();
    unsigned long long code = 0;
    for (int i = 0; i < x.length(); i++) {
    char c = x.charAt(i);
   if (c < '0' || c > '9') break;
   code *= 10;
   code += (c - '0');
                                         } 
// now we are ready to send 64-bit long long integer to Irsend 
      irsend.sendRC6(code, 36);
    }
  }]

I am sure you can do a better job, at the moment this one works!!!