Hello, I am new to Arduino and I need help fixing a project that uses a remote and an IR sensor to turn a servo in two different positions but the "if" statement seems to be completed every time.
please help fix the code, thank you.
code
#include <IRremote.h>
#include <Servo.h>
const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;
Servo ms;
void setup(){
Serial.begin(9600);
irrecv.enableIRIn();
irrecv.blink13(true);
ms.attach(9);
}
void loop(){
if (irrecv.decode(&results)){
irrecv.resume();
if ("FFA25D" == results.value, HEX){ // if button 1 is pushed
Serial.println("1");
ms.write(35);
delay(1000);
}
if ("FFE21D" == results.value, HEX){
ms.write(100); //if button 2 is pushed
delay(1000);
Serial.println("2");
}
}
}