wifi.begin add error in IR receiving code · Issue #1995 · crankyoldgit/IRremoteESP8266 (original) (raw)

Version/revision of the library used

2.8.5

Describe the bug

The library works really fine and all hex received number are ok.
But if I put wifi.begin in void setup, the numbers in rx mode are random and very rarely the right code is given

To Reproduce

use IRRecvDemo.ino
put #include <WiFi.h> in the sketch and WiFi.begin(net,pwd) in the void setup
complle
please note that net and pwd must be real, so you must be really connected to your router
ESP32S and WROOM 32D give same problem

Example code used

#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>

const uint16_t kRecvPin = 36;
IRrecv irrecv(kRecvPin);
decode_results results;

#include <WiFi.h>
char NetName[26] = "yournet"; 
char NetPwd[30] = "yourpwd";

void setup() {
  Serial.begin(115200);
  WiFi.begin(NetName, NetPwd);
  irrecv.enableIRIn();  // Start the receiver
  while (!Serial)  // Wait for the serial connection to be establised.
    delay(150);
  Serial.println();
  Serial.print("IRrecvDemo is now running and waiting for IR message on Pin ");
  Serial.println(kRecvPin);
}

void loop() {
  if (irrecv.decode(&results)) {
    // print() & println() can't handle printing long longs. (uint64_t)
    serialPrintUint64(results.value, HEX);
    Serial.println("");
    irrecv.resume();  // Receive the next value
  }
  delay(10);
}`

Expected behaviour

using a samsung tv remote control

Serial monitor :
without WiFi.begin
E0E020DF
E0E020DF
E0E020DF
E0E020DF
E0E020DF
E0E020DF
E0E020DF
E0E020DF
E0E020DF
E0E020DF

with WiFi.begin
D1E21191
E3AB4430
E0E020DF
E0E020DF
4824BC8A
A432D17A
E0E020DF
AA9C7144
55560F29
E0E020DF
834ED9B0
FC7307DE

What brand/model IR demodulator are you using?

VS1838

Circuit diagram and hardware used (if applicable)

+5V power
out pin directly to pin 36. I tried other pins : same problem

I have followed the steps in the [Troubleshooting Guide]

YES

More ...

I wrote here although you said that VS1838 gives problems. I have no problem using it. I have only if i put wifi.begin

may thanks for your patience