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

Moderator: igrr

User avatar
By reddatto
#38030
PaulDG wrote:I managed to get the transmitter working from his examples but the receiver was more difficult, I had to ditch his timing loop and go with a simple timer in the main loop. I ended up sampling at 41 micro seconds.
Code: Select allvoid loop() {
  if ( micros() - PointA > 41 ) {
    irrecv.pgti();
    PointA = micros();
  }
 
  if (irrecv.decode(&results)) {
    Serial.println(results.value);
    delay(800); // Stops Key Bounce
    irrecv.resume(); // Receive the next value
  }

PaulDG


Thanks PaulDG for the inspiration. I had written my own bit-bang NEC code for transmit months ago and works fine but was having no joy with receiver. Once I took your approach of ditching the hardware timer it only took a couple of hours to get it working.