IR sensor Issue

Hello there;

I have an issue with ir sensor. I made an ir sensor using TSOP2238 and with this sensor I can control a motor or selenoid valf. After that, I wanted to control the motor remotely using the Blynk app. and the problem started here. I am using NodeMCU v3 and Iphone 11pro as hardware. I wrote the software with the Arduino IDLE program. The software I develop for the IR sensor works without any problems. I can disable the IR sensor and control the motor remotely with the ESP8266_Standalon included in the examples of the Blynk library. The problem occurs when I combine these two codes. IR sensor is working. But I can’t control the motor from the Blynk app. By the way, I am using L293D as motor driver. I added 2 buttons from the Blynk application and with these buttons I can control the motor driver and therefore the motor. Please help me about this issue. I share the code below;

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>



#define tsop 12
#define led 4
#define selenoidIn_1 13
#define selenoidIn_2 15
#define irLed 14



char auth[] = "lvGvhHsebiilIOMZXuhCrVx5CcoEehs_";


char ssid[] = "VsFuar";
char pass[] = "Valfsel78!";

int tsop_value;
int count = 0;
int rightTime = 0;

void setup()
{
 
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  

  pinMode(tsop, INPUT);
  pinMode(led, OUTPUT);
  pinMode(selenoidIn_1, OUTPUT);
  pinMode(selenoidIn_2, OUTPUT);
  digitalWrite(led, LOW);
  analogWriteFreq(40000);
}

void loop()
{
  Blynk.run();
  Fotosel();
  

  
}

void Fotosel()
{
  analogWrite(irLed, 614.4);
  tsop_value = digitalRead(tsop);
  if (tsop_value == 0 && count == 0)
  {
    for (int i = 0; i < 1; i++)
    {
      rightTime++;
      delay(300);
    }
    tsop_value = digitalRead(tsop);
    if (tsop_value == 0 && rightTime != 0)
    {
      digitalWrite(led, HIGH);
      delay(100);
      digitalWrite(selenoidIn_1, HIGH);
      digitalWrite(selenoidIn_2, LOW);
      delay(10);
      digitalWrite(selenoidIn_1, LOW);
      digitalWrite(selenoidIn_2, LOW);
      count++;
    }
    else if (tsop_value == 1)
    {
      digitalWrite(led, LOW);
      delay(100);
      digitalWrite(selenoidIn_1, LOW);
      digitalWrite(selenoidIn_2, LOW);
      rightTime = 0;
    }
  }

  else if (tsop_value == 0 && count == 1)
  {
  
    digitalWrite(selenoidIn_1, LOW);
    digitalWrite(selenoidIn_2, LOW);
  }

  else if (tsop_value == 1 && count == 1)
  {
    for (int j = 0; j < 1; j++)
    {
      rightTime++;
      delay(300);
    }
    tsop_value = digitalRead(tsop);
    if (tsop_value == 1 && rightTime != 0)
    {
      digitalWrite(led, LOW);
      delay(100);
      digitalWrite(selenoidIn_1, LOW);
      digitalWrite(selenoidIn_2,HIGH);
      delay(12);
      digitalWrite(selenoidIn_1, LOW);
      digitalWrite(selenoidIn_2,LOW);  
      count++;
    }
    else if (tsop_value == 0)
    {
      digitalWrite(led, HIGH);
      delay(100);
      digitalWrite(selenoidIn_1, LOW);
      digitalWrite(selenoidIn_2,LOW);
      rightTime = 0;
    }
  }

  else
  {
    digitalWrite(led, LOW);
    digitalWrite(selenoidIn_1, LOW);
    digitalWrite(selenoidIn_2,LOW);
    count = 0;
  }
}

@Atahan please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code.
Triple backticks look like this:
```

Pete.