2

my board is a firebeetle esp32 that I am using as an IR remote.

After using the Ken Shirrif IRremote library for about 6 months successfully, then the time came to change a few things on the web front end. This has been a disaster.

I tried to recompile my working code that the board is currently using and got errors everywhere I turned.

So i switched libraries to this one;

https://github.com/ExploreEmbedded/Arduino-IRremote

Now it does compile successfully, with the only change between the two libraries was to pull out the pin I defined for IR tx in the Ken Shirriff library. For example; previously my code looked like this to work with the old library.

IRsend irsend(33);

Now it looks like this;

IRsend irsend;

As stated, it does compile; only issue is that IR doesn't work. It says in the library that pin 5 is defined as the tx pin for the ESP32 in boarddefs. Snip from boarddefs where I believe pin 5 is defining IR tx.

// ESP32 has it own timer API and does not use these macros, but to avoid ifdef'ing
// them out in the common code, they are defined to no-op. This allows the code to compile
// (which it wouldn't otherwise) but irsend will not work until ESP32 specific code is written
// for that -- merlin
// As a warning, sending timing specific code from an ESP32 can be challenging if you need 100%
// reliability because the arduino code may be interrupted and cause your sent waveform to be the
// wrong length. This is specifically an issue for neopixels which require 800Khz resolution.
// IR may just work as is with the common code since it's lower frequency, but if not, the other
// way to do this on ESP32 is using the RMT built in driver like in this incomplete library below
// https://github.com/ExploreEmbedded/ESP32_RMT
#elif defined(IR_TIMER_USE_ESP32)
#define TIMER_CHANNEL       1
#define TIMER_LENGHT        8 //8-bit Timer
#define TIMER_PWM_PIN      5
#define TIMER_ENABLE_PWM    ledcAttachPin(TIMER_PWM_PIN, TIMER_CHANNEL);         
#define TIMER_DISABLE_PWM   ledcDetachPin(TIMER_PWM_PIN); 
#define TIMER_RESET  
#define TIMER_ENABLE_INTR    
#define TIMER_DISABLE_INTR   
#define TIMER_INTR_NAME      

//---------------------------------------------------------
// Unknown Timer
//
#else
#   error "Internal code configuration error, no known IR_USE_TIMER# defined\n"
#endif

#endif // ! boarddefs_h

I know it says that IR with the ESP32 will not work, but it said the same thing for several libraries that i've used that do work, most notably the one by Ken; which appears to have moved here.

https://github.com/z3t0/Arduino-IRremote

Quick example of my code;

#include "IRremote.h"
  IRsend irsend;
int khz = 38;
String input;
  String tv;
void changehdmi() {
if (Server.args() > 0 ) {
  for ( uint8_t i = 0; i < Server.args(); i++ ) {
    if (Server.argName(i) == "input") {
      input = String(Server.arg(i));
      Serial.println("input is " + input);
    }
    if (Server.argName(i) == "tv") {
      tv = String(Server.arg(i));
      Serial.println("tv is " + tv);
    }

  }
}
if (input == "1" && tv == "1") {
  unsigned int irSignal[] = {9000, 4450, 600, 550, 550, 550, 600, 550, 550, 550, 600, 500, 600, 550, 550, 600, 550, 550, 600, 1650, 550, 1700, 550, 1700, 550, 1700, 550, 1700, 550, 1700, 550, 1650, 600, 1650, 550, 1700, 550, 550, 600, 550, 550, 1700, 550, 550, 600, 500, 600, 550, 550, 600, 550, 550, 600, 1650, 550, 1700, 550, 550, 600, 1650, 550, 1700, 550, 1700, 550, 1700, 550}; // NEC FF906F
  irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz);
}
else if (input == "2" && tv == "1") {
  unsigned int irSignal[] = {9000, 4500, 550, 550, 600, 550, 550, 550, 550, 600, 550, 550, 600, 550, 550, 550, 550, 550, 600, 1650, 600, 1700, 500, 1700, 600, 1700, 500, 1700, 550, 1700, 550, 1700, 550, 1700, 550, 1700, 550, 550, 550, 1700, 550, 1700, 550, 1700, 550, 550, 550, 550, 600, 550, 550, 550, 600, 1700, 500, 600, 550, 550, 600, 500, 600, 1650, 600, 1650, 600, 1650, 550}; // NEC FFB847
  irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz);
}

Has anyone gotten this to work recently? The libraries that are available seem to have lost support for this functionality.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy