Chat here about code rewrites, mods, etc... with respect to the github project https://github.com/esp8266/Arduino

Moderator: igrr

User avatar
By Torin42
#19754 Hello everyone!

I ported the half of the Arduino IRremote library to ESP8266 so now it is easy to send IR signals (the receive part is not ported so far).

The library is available here: https://github.com/markszabo/IRremoteESP8266/

Examples also included. If you find any bug or have a suggestion, please feel free to drop a comment here or just simply make a pull request :)

Best regards:
Mark
User avatar
By probono
#21149 Awesome! Can you explain what you did and how? How hard would it be to implement receiving too?

Also, do you know https://github.com/cyborg5/IRLib/ - I think it is a more recent, updated version of IRremote, see http://tech.cyborg5.com/irlib/docs/

How hard would it be to port your changes to that library?
User avatar
By martinayotte
#21161 Since few weeks, I've also worked on IRremote, trying to port works been done under Sming environment to espduino.
( see thread viewtopic.php?f=33&t=3357#p19122 )
I've got it compile, but at runtime, the IRrecv just gave me random/inconstant recording. (I think this part need to be re-written using pin interrupts instead of timed pin pooling)
But the IRsend seems to work properly (much more easier since it only bitbanging a PWM output) : fortunately, I had previously recorded arrays of values for each keys of by Motorola Cable setupbox previously done on an arduino, I've copy/paste them in ESP sketch and the IRsend() properly sent them to the setupbox.
User avatar
By Torin42
#21892
probono wrote:Awesome! Can you explain what you did and how? How hard would it be to implement receiving too?

Also, do you know https://github.com/cyborg5/IRLib/ - I think it is a more recent, updated version of IRremote, see http://tech.cyborg5.com/irlib/docs/

How hard would it be to port your changes to that library?

Well basically instead of pwm I used this 'hack':
Code: Select allvoid IRsend::mark(int time) {
  // Sends an IR mark for the specified number of microseconds.
  // The mark output is modulated at the PWM frequency.
  long beginning = micros();
  while(micros() - beginning < time){
    digitalWrite(IRpin, HIGH);
    delayMicroseconds(halfPeriodicTime);
    digitalWrite(IRpin, LOW);
    delayMicroseconds(halfPeriodicTime);
  }
}

Also the corresponding 'enableIROut()' was changed:
Code: Select allvoid IRsend::enableIROut(int khz) {
  // Enables IR output.  The khz value controls the modulation frequency in kilohertz.
  halfPeriodicTime = 500/khz; // T = 1/f but we need T/2 in microsecond and f is in kHz
}


I think that won't be too hard to port these changes in that library, but I don't have time for that atm :? :)