I am trying to use a boolean running in an if else statment and am unsure of how to code it

this is my current code

type or paste code here#include <IRremote.h>
const int RELAY_PIM = 10;
int IR_Recv = 2;  //IR Receiver Pin 2
int LED_PIN = 13;
int lightPin = 5;
int inPin = 8;
//when running=1, the liquid is detected, print out 1, otherwise, print out 0; running=0, the liquid is detected, print out 0, otherwise, print out 1.
  int modePin = 9;
  boolean running = 0;
IRrecv irrecv(IR_Recv);
decode_results results;
int a = 0;



void setup() {
  pinMode(13, OUTPUT);
  Serial.begin(9600);   //starts serial communication
  irrecv.enableIRIn();  // Starts the receiver
  pinMode(inPin, INPUT);
  pinMode(modePin, OUTPUT);
  digitalWrite(modePin, running);
  pinMode(10, OUTPUT);
  irrecv.blink13(true);
}

void loop() {

  if (irrecv.decode(&results)) {
    Serial.print(results.value);
    Serial.print(",");
    Serial.println("");
    irrecv.resume();
    long int decCode = results.value;
    Serial.println(decCode);
    if (results.value == 16580863) {
      a = a + 1;
    }

    if (a == 1) {
      digitalWrite(13, HIGH);
    } else {
      digitalWrite(13, LOW);
      a = 0;
    }
    if (results.value == 16613503) {
      digitalWrite(10, HIGH);
      digitalWrite(13, HIGH);
      delay(22605);
      digitalWrite(10, LOW);
    }
    if (results.value == 16597183) {  //Select button 600ml
      digitalWrite(10, HIGH);
      digitalWrite(13, HIGH);
      delay(35000);
      digitalWrite(10, LOW);
    }
    if (inPin == HIGH) {
      digitalWrite(5, HIGH);
    } else {
      digitalWrite(5, LOW);
    }
  }
}

and the last 7 lines are the issue if anyone could help that would be great also when running=1, the liquid is detected, print out 1, otherwise, print out 0; running=0, the liquid is detected, print out 0, otherwise, print out 1.

Did you notice this:

It seems, that you are using a old version 2.0 code / example.
This version is no longer supported!
Please use one of the new code examples from the library,
available at "File > Examples > Examples from Custom Libraries / IRremote".

that shouldn't effect the sensor though that's another part of the code

ok.

wrong. this if will always false because

constant HIGH is 1, and 1 == 8 is false

how do i fix it

what you want to reach with this?

what do you mean?

which liquid? detected by who?

where is printer?

so its a non contact liquid level sensor and when it detects any liquid it should print out 1 and if its not in code its cus i copy and pasted it so if code is missing please help me find what i need to do

i dont know what you want to get with this project and with this particular pin, so i am not able to imagine how to fix unknown thing.

should? print out? do you mean this sensor set its output pin to HIGH?

so the project is a remote controlled drink dispenser and that point of the sesnor is to tell the user when the bottle is running low by turning on a led which is in pin 5 and i have been trying to figure out the code for how to do it and i am getting no wear

idk if the code is bad tell me what to delet and what to do instead

if(digitalRead(SensorPin)==HIGH)digitalWrite(LED, HIGH);

or short:

digitalWrite(LED, digitalRead(SensorPin));

what should i delete

int SensorPin = 9;
int LED_PIN = 13;

void setup() {
  pinMode(LED_PIN , OUTPUT);
  pinMode(SensorPin, INPUT_PULLUP);
}

void loop() {
  digitalWrite(LED_PIN, digitalRead(SensorPin));
}

thank you so much

Your topic does not indicate a problem with the IDE and therefore has been moved to a more suitable location on the forum.