I have been building this system and i am stuck#include <IRremote.h> const int RELAY_PIM = 10; int IR_Recv = 2; //IR Receiver Pin 2 int LED_PIN = 13;

So i have been building a system and tested the code individually and i have checked wiring and it all worked individually i am also not getting any errors but the system isn't working and i was just wondering if it was the code that was the problem any help would be appreciated

#include <IRremote.h>
const int RELAY_PIM = 10;
int IR_Recv = 2;  //IR Receiver Pin 2
int LED_PIN = 13;
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(13, OUTPUT);
  irrecv.blink13(true);
}

void loop() {
  Serial.println(digitalRead(inPin));

  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;
    }
  }
  irrecv.resume();
  if (results.value == 16613503) {
    digitalWrite(10, HIGH);
    digitalWrite(13, HIGH);
    delay(5000);
    digitalWrite(10, LOW);
  }
  if (results.value == 16597183) {  //Select button 600ml
    digitalWrite(10, HIGH);
    digitalWrite(13, HIGH);
    delay(10000);
    digitalWrite(10, LOW);
  }
  irrecv.resume();
}

you may have more response if you describe what it should do, what it does do , or, what it doesn't do .... :unamused:

so i basicacly is a ir remote that sends a signal to a relay which turn on for x amount of time. thats pin 10. then ou have pin 13 which is lights, and pin 2 is the ir recv. u also have a senosor which is a non contact liquid level sensor that when its 0 it detects water 1 it doesn't

Please take care that your code is properly aligned.
In IDE press CTRL-T. Then paste the code in this thread.

i did that it still doesn't work

Changing the format does not really change your code. It makes it easier human readable.
Your nested if's will be easier to check.
That is why you should post your code after formatting. I see you changed the code in your original post. That will make this thread hard to follow...

What does not work? It would really help if you were more specific...

if (results.value == 16613503) {
    digitalWrite(10, HIGH);
    digitalWrite(13, HIGH);
    delay(5000);
    digitalWrite(10, LOW);
  }
  if (results.value == 16597183) {  //Select button 600ml
    digitalWrite(10, HIGH);
    digitalWrite(13, HIGH);
    delay(10000);
    digitalWrite(10, LOW);

Should all this only be checked after reading what the receiver has received?
Is blocking code. Once inside this if, your code will not respond to the irremote for 10 seconds...

well when i click the button on the controller the pump which is conected to the relay doesn't start

i don't really understand what your trying to say

Here you read the latest message from the receiver.
If there is a message, the first if ischevked.
The other if blocks are also tested if there is no new message..

At the moment you push the remote button, does your Serial.print print the correct value?

so how do i fix it

no i doesn't print anything

Move the blocks inside the if block were you read the message...
Basically remove one of }}
And add one } at end. Then ctrl-t...
Then paste code again in new post

What is this supposed to do?
I am not familiar with your ir library...
I would expect that one call in loop should be sufficient.
Bu maybe it is not needed at all, since you did not stop or pause receiving... so what is the use of resume?

i coppied the code from somewhere not sure

#include <IRremote.h>
const int RELAY_PIM = 10;
int IR_Recv = 2;  //IR Receiver Pin 2
int LED_PIN = 13;
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(13, OUTPUT);
  irrecv.blink13(true);
}

void loop() {
  Serial.println(digitalRead(inPin));

  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(5000);
      digitalWrite(10, LOW);
    }
    if (results.value == 16597183) {  //Select button 600ml
      digitalWrite(10, HIGH);
      digitalWrite(13, HIGH);
      delay(10000);
      digitalWrite(10, LOW);
    }
  }
}

it is now showing up in serial monitor but it isn't turning the relay pin high

What shows up?