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.