Chat freely about anything...

User avatar
By hassan1551
#88811 I am using ESP8266 Wemos D1 mini. I have 2 YS-IRTM connected to the ESP8266, all you need to know about the YS-IRTM is that it uses UART interface to communicate. So, I have used one with the "Serial" object and another one with the SoftwareSerial created object. They both work perfectly, but when they receive an IR signal at the same time, the "YS-IRTM" both send messages using UART to the ESP8266 simultaneously. At that point of time, it shows me one of messages from "Serial" or from "SoftwareSerial", but never both at a small difference of time, and that delay for the second message to show up in "SoftwareSerial" takes at nearly 0.6 to 1.5 seconds, which is a lot. To make it very simple, here is an example: Two messages were sent simultaneously, one for the Serial and the other for SoftwareSerial, Serial got it first and then it checked up on the SoftwareSerial using the "available()" function, but got nothing, so it has to wait nearly 1.5 of seconds in order to show up. Here is the code:

Code: Select allvoid loop() {
while (Serial.available()) {
    X1Data[X1Ptr++] = Serial.read();
    delay(2);
    enteredX1 = true;
  }
  delay(1500); // it gets delayed A LOT, I don't know why..
  while (softwareSerial.available()) {
    X2Data[X2Ptr++] = softwareSerial.read();
    delay(2);
    enteredX2 = true;
  }
}


I could use two ESP8266s, each one of them only uses its own Serial. In that way, I solved the issue. But, it costs a lot and takes more space. So, I am trying to figure out how to reduce the delay in some way.