I have an ai Thinker NodeMCU dev board connected with an Ir diode.
i collected with my raspberry and irrecord the specific key codes. My tests to controll my tv with these code over irsend is functioning (e.g. irsend SEND_ONCE philips KEY_MUTE)
*KEY_MUTE stands for the signal 0x0FFFF2 btw for signal 1048562
But i have problem to send the signal over the dev board. A roundtrip test (rerecording the data from esp to raspi) have a complete other hex lis. i.g.
KEY_MUTE 0x0FFFF2 => 1048562
KEY_MUTE 0x10000D => 1048589
here is my code *striped some lines:
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <IRremoteESP8266.h>
const char* ssid = "*";
const char* password = "*";
MDNSResponder mdns;
ESP8266WebServer server(80);
IRsend irsend(13);
void handleRoot() {
server.send(200, "text/html", "<html><body><a href=\"ir?code=0x0FFFF2&key=KEY_MUTE&int=1048562\">");
}
void handleIr(){
for (uint8_t i=0; i<server.args(); i++){
if(server.argName(i) == "int")
{
unsigned long code = server.arg(i).toInt();
int foo = server.arg(i).toInt();
// testing for the roundtrip
for(int i = 0; i < 10; i++) {
irsend.sendRC6(foo, 21);
delay(10);
Serial.println(foo);
}
}
}
handleRoot();
}
void handleNotFound(){
String message = "File Not Found\n\n";
message += "URI: ";
message += server.uri();
message += "\nMethod: ";
message += (server.method() == HTTP_GET)?"GET":"POST";
message += "\nArguments: ";
message += server.args();
message += "\n";
for (uint8_t i=0; i<server.args(); i++){
message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
}
server.send(404, "text/plain", message);
}
void setup(void){
irsend.begin();
Serial.begin(115200);
WiFi.begin(ssid, password);
Serial.println("");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
if (mdns.begin("esp8266", WiFi.localIP())) {
Serial.println("MDNS responder started");
}
server.on("/", handleRoot);
server.on("/ir", handleIr);
server.on("/inline", [](){
server.send(200, "text/plain", "this works as well");
});
server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP server started");
}
void loop(void){
server.handleClient();
}
the base bit was switch from 21 to 22
So, on this point totally clueless how to debug this shi*** .
so maybe the folk from here have some ideas.
esptest lirc.conf
name esptest
bits 22
flags RC6|CONST_LENGTH
eps 30
aeps 100
header 2665 915
one 437 470
zero 437 470
gap 34528
min_repeat 9
# suppress_repeat 9
# uncomment to suppress unwanted repeats
toggle_bit_mask 0x3
rc6_mask 0x20000
begin codes
KEY_POWER 0x11000C
KEY_MUTE 0x10000D
KEY_ARCHIVE 0x1100CC
KEY_INFO 0x10000F
KEY_1 0x110001
KEY_2 0x110002
KEY_3 0x100003
KEY_4 0x110004
KEY_5 0x110005
KEY_6 0x100006
KEY_7 0x110007
KEY_8 0x100008
KEY_9 0x110009
KEY_0 0x110000
end codes
end remote
"functioning lirc.conf"
begin remote
name philips
bits 21
flags RC6
eps 30
aeps 100
header 2658 911
one 431 457
zero 431 457
gap 83814
min_repeat 1
# suppress_repeat 1
# uncomment to suppress unwanted repeats
toggle_bit_mask 0x0
rc6_mask 0x10000
begin codes
KEY_0 0x0EFFFF
KEY_1 0x0EFFFE
KEY_2 0x0EFFFD
KEY_3 0x0FFFFC
KEY_4 0x0EFFFB
KEY_5 0x0EFFFA
KEY_6 0x0FFFF9
KEY_7 0x0EFFF8
KEY_8 0x0FFFF7
KEY_9 0x0EFFF6
KEY_MUTE 0x0FFFF2
KEY_ARCHIVE 0x0EFF33
KEY_INFO 0x0FFFF0
KEY_BACK 0x0EFFF5
KEY_MENU 0x0FFFAB
KEY_UP 0x0EFFA7
KEY_DOWN 0x0FFFA6
KEY_LEFT 0x0EFFA4
KEY_RIGHT 0x0FFFA5
KEY_VOLUMEDOWN 0x0EFFEE
KEY_VOLUMEUP 0x0EFFEF
KEY_CHANNELDOWN 0x0FFFDE
KEY_CHANNELUP 0x0FFFDF
KEY_OK 0x0FFFA3
KEY_RED 0x0EFF92
KEY_BLUE 0x0FFF8F
KEY_GREEN 0x0EFF91
KEY_YELLOW 0x0FFF90
KEY_OPEN 0x0FFFC7
KEY_POWER 0x0EFFF3
end codes
end remote