If statement with IRremote library

I have surround sound that doesn't have remote control option but I have attached a motor to the knob with arduino and have an IR receiver. From the examples I have found I have been unable to get a working if statement for a signal from the IR receiver.

Please let me know if you need additional information.

Please let me know if you need additional information.

Seeing the code would be helpful.

Did you read this before posting a programming question ?

Here is the complete/ but short code for the using the project with serial monitor (as well as what I understand of IRreciever).

#include <IRremote.h>
#include <IRremoteInt.h>


int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
int motorSpeed;
boolean muteToggle;
byte x;

void setup() {
  pinMode(2, OUTPUT); //direction switch
  pinMode(3, OUTPUT); //direction switch
  pinMode(9, OUTPUT); //speed control
  irrecv.enableIRIn(); //start the reciever
  muteToggle = true;
  motorSpeed = 0;
  Serial.begin(9600);
}


void loop() {
  byte x = Serial.read();
  if (x == B00111000) { //8
    volumeUp();
  }
  if (x == B00110010) { //2
    volumeDown();
  }
  if (x == B00110101) { //5
    if (muteToggle == true) {
      mute();
    }
    if (muteToggle == false) {
      unMute();
    }
    muteToggle = !muteToggle;
  }
  irrecv.resume(); // Receive the next value
}

void volumeUp() {
  digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  motorSpeed = 200;
  analogWrite(9, motorSpeed);
  delay(236);//volume up
  motorSpeed = 0;
  analogWrite(9, motorSpeed);
  muteToggle = true;
}

void volumeDown() {
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  motorSpeed = 200;
  analogWrite(9, motorSpeed);
  delay(450); //volume
  motorSpeed = 0;
  analogWrite(9, motorSpeed);
  muteToggle = true;
}

void mute() {
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  motorSpeed = 200;
  analogWrite(9, motorSpeed);
  delay(12000);
  motorSpeed = 0;
  analogWrite(9, motorSpeed);
}

void unMute() {
  digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  motorSpeed = 200;
  analogWrite(9, motorSpeed);
  delay(1000);
  motorSpeed = 0;
  analogWrite(9, motorSpeed);
}

Here is the blog post and IR product I am using.

http://tech.yeesiang.com/receive-ir-value-with-arduino/
I want pressing “+”, “-” and mute within if statements.

  byte x = Serial.read();

Whaaaaa? Aren't you looking for IR input?

I was using serial monitor for troubleshooting and forgot to re-include the IR remote aspect. The hex codes are different as my remote is different than the one in the blog post above.

#include <IRremote.h>
#include <IRremoteInt.h>


int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
int motorSpeed;
boolean muteToggle;
char x;
word HEXcode;

void setup() {
  pinMode(2, OUTPUT); //direction switch
  pinMode(3, OUTPUT); //direction switch
  pinMode(9, OUTPUT); //speed control
  irrecv.enableIRIn(); //start the reciever
  muteToggle = true;
  motorSpeed = 0;
  Serial.begin(9600);
}


void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    HEXcode = (results.value, HEX);
    if (HEXcode == "FD807F"({
    volumeUp();
    }
    if (HEXcode == "FD906F"({
    volumeDOWN();
    }
    if (HEXcode == "FDA05F"({
    if (muteToggle == true) {
        mute();
      }
      if (muteToggle == false) {
        unMute();
      }
      muteToggle = !muteToggle;
    }
    irrecv.resume(); // Receive the next value
  }
  byte x = Serial.read();
  if (x == B00111000) { //8
    volumeUp();
  }
  if (x == B00110010) { //2
    volumeDown();
  }
  if (x == B00110101) { //5
    if (muteToggle == true) {
      mute();
    }
    if (muteToggle == false) {
      unMute();
    }
    muteToggle = !muteToggle;
  }
}


void volumeUp() {
  digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  motorSpeed = 200;
  analogWrite(9, motorSpeed);
  delay(236);//volume up
  motorSpeed = 0;
  analogWrite(9, motorSpeed);
  muteToggle = true;
}

void volumeDown() {
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  motorSpeed = 200;
  analogWrite(9, motorSpeed);
  delay(450); //volume
  motorSpeed = 0;
  analogWrite(9, motorSpeed);
  muteToggle = true;
}

void mute() {
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  motorSpeed = 200;
  analogWrite(9, motorSpeed);
  delay(12000);
  motorSpeed = 0;
  analogWrite(9, motorSpeed);
}

void unMute() {
  digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  motorSpeed = 200;
  analogWrite(9, motorSpeed);
  delay(1000);
  motorSpeed = 0;
  analogWrite(9, motorSpeed);
}

Hopefully this is enough to get the problem solved.

HEXcode = (results.value, HEX);
    if (HEXcode == "FD807F"({

The compiler barfed big time on that.

What's wrong with

    if (results.value== 0xFD807F){

Yeah, that was me who barfed. Thanks, problem solved.