Thought the code was bad but nothing works

I can’t seem to upload ANY IR code with out getting a error message. I thought it was something I did wrong but I have tried example codes and codes on the web and none of them work. I tried 3 new boards and my old one that is working fine at the moment with the same code I am trying to use. I can upload codes that do not have IR in them just fine.

The code I am trying to upload has been working without a hitch for the last 6 months so why can’t i copy and past it?

##message##

‘IRrecv’ does not name a type

but when I copy and paste any type of IR code if comes up with the same message.
here is my code I am trying to use

// controls SIX servos via IR remote at set positions returning back to 0 when OFF or any other servo is called

#include <Servo.h>
#include <IRremote.h>

int RECV_PIN = 11;
IRrecv irrecv (RECV_PIN);
decode_results results;

// the setup routine runs once when you press reset:
void setup() 

unsigned long Value1 = 0xFD00FF; // 21 channel IR remote 
unsigned long Value2 = 0xFD80DF; // not in use
unsigned long Value3 = 0xFD40BF; // not in use
unsigned long Value4 = 0xFD20DF;
unsigned long Value5 = 0xFDA05F;
unsigned long Value6 = 0xFD609F;
unsigned long Value7 = 0xFD10EF;
unsigned long Value8 = 0xFD906F; 
unsigned long Value9 = 0xFD50AF;
unsigned long Value10 = 0xFD30CF;
unsigned long Value11 = 0xFDB04F;
unsigned long Value12 = 0xFD708F;
unsigned long Value13 = 0xFD08F7;
unsigned long Value14 = 0xFD8877;
unsigned long Value15 = 0xFD48B7; 
unsigned long Value16 = 0xFD28D7;
unsigned long Value17 = 0xFDA857;
unsigned long Value18 = 0xFD6897;
unsigned long Value19 = 0xFD18E7;
unsigned long Value20 = 0xFD9867;
unsigned long Value21 = 0xFD58A7;


Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;

// the setup routine runs once when you press reset:
void setup()          
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}
{
  servo1.write(0);
  servo2.write(0);
  servo3.write(0);
  servo4.write(0);
  servo5.write(0);
  servo6.write(0);

  servo1.attach(2); 
  servo2.attach(3); 
  servo3.attach(4); 
  servo4.attach(5);
  servo5.attach(6); 
  servo6.attach(7);
}

// the loop routine runs over and over again forever:
void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);

    if(results.value == Value1) {
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
    }
    else if  (results.value == Value4){ // servo 1-180
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo1.write(180);
    }
    else if  (results.value == Value5){ // servo 1-110
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo1.write(110);
    }
    else if  (results.value == Value6){ // servo 1-90
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo1.write(90);
    } 
    else if  (results.value == Value7){ // servo 2-180
      servo1.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo2.write(180);
    }
    else if  (results.value == Value8){ // servo 2-110
      servo1.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo2.write(110);
    }
    else if  (results.value == Value9){ // servo 2-90
      servo1.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo2.write(90);
    } 
    else if  (results.value == Value10){ // servo 3-180
      servo1.write(0);
      servo2.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo3.write(180);
    }
    else if  (results.value == Value11){ // servo 3-110
      servo1.write(0);
      servo2.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo3.write(110);
    }
    else if  (results.value == Value12){ // servo 3-90
      servo1.write(0);
      servo2.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo3.write(90);
    }
    else if  (results.value == Value13){ // servo 4-180
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo5.write(0);
      servo6.write(0);
      servo4.write(180);
    }
    else if  (results.value == Value14){ // servo 4-110
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo5.write(0);
      servo6.write(0);
      servo4.write(110);
    }
    else if  (results.value == Value15){ // servo 4-90
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo5.write(0);
      servo6.write(0);
      servo4.write(90);
    }
    else if  (results.value == Value16){ // servo 5-180
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo6.write(0);
      servo5.write(180);
    }
    else if  (results.value == Value17){ // servo 5-110
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo6.write(0);
      servo5.write(110);
    }
    else if  (results.value == Value18){ // servo 5-90
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo6.write(0);
      servo5.write(90);
    }
    else if  (results.value == Value19){ // servo 6-180
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(180);
    }
    else if  (results.value == Value20){ // servo 6-110
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(110);
    }
    else if  (results.value == Value21){ // servo 6-90
      servo1.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo5.write(0);
      servo6.write(90);
    }

    irrecv.resume(); // Receive the next value}
  }
}

IRRemote library isn't installed properly.

I'm not sure what that means Arch?

What pisses me off is that this is the SAME EXACT code that has been working for the last 6 months. On top of that I have tried over 10 other IR codes and NONE of them work and they all give the same message.

I can't even upload a simple IR decoder without getting the same message.

Scroll up to the first compiler error - assuming you haven't already. What is it?

kaz321: I'm not sure what that means Arch?

It means that you are trying to use a library that hasn't been properly installed on whatever computer you are currently using.

http://arduino.cc/en/Guide/Libraries

Although this part is certainly wrong:

{
  servo1.write(0);
  servo2.write(0);
  servo3.write(0);
  servo4.write(0);
  servo5.write(0);
  servo6.write(0);

  servo1.attach(2); 
  servo2.attach(3); 
  servo3.attach(4); 
  servo4.attach(5);
  servo5.attach(6); 
  servo6.attach(7);
}

As is this:

// the setup routine runs once when you press reset:
void setup() 

unsigned long Value1 = 0xFD00FF; // 21 channel IR remote 
unsigned long Value2 = 0xFD80DF; // not in use
unsigned long Value3 = 0xFD40BF; // not in use

Edit: I get the feeling that there was a copy paste error.

WOW! I forgot to install the IR library on the new computer.

that fixed everything! As stated in other post’s it may be wrong, crude and ugly but it works perfect…

Thanks for the library advice!

here is the code that works with the 4 dollar piece of crap remote you can buy online if anyone wants to modify it for something.

/// controls SIX servos via IR remote at set positions returning back to 0 when OFF or any other servo is called

#include <Servo.h>
#include <IRremote.h>



unsigned long Value1 = 0xFD00FF; // 21 channel IR remote 
unsigned long Value2 = 0xFD80DF; // not in use
unsigned long Value3 = 0xFD40BF; // not in use
unsigned long Value4 = 0xFD20DF;
unsigned long Value5 = 0xFDA05F;
unsigned long Value6 = 0xFD609F;
unsigned long Value7 = 0xFD10EF;
unsigned long Value8 = 0xFD906F; 
unsigned long Value9 = 0xFD50AF;
unsigned long Value10 = 0xFD30CF;
unsigned long Value11 = 0xFDB04F;
unsigned long Value12 = 0xFD708F;
unsigned long Value13 = 0xFD08F7;
unsigned long Value14 = 0xFD8877;
unsigned long Value15 = 0xFD48B7; 
unsigned long Value16 = 0xFD28D7;
unsigned long Value17 = 0xFDA857;
unsigned long Value18 = 0xFD6897;
unsigned long Value19 = 0xFD18E7;
unsigned long Value20 = 0xFD9867;
unsigned long Value21 = 0xFD58A7;

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;

Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;

// the setup routine runs once when you press reset:
void setup() {              

  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  

  servo1.write(0);
  servo2.write(0);
  servo3.write(0);
  servo4.write(0);
  servo5.write(0);
  servo6.write(0);
  
  servo1.attach(2); 
  servo2.attach(3); 
  servo3.attach(4); 
  servo4.attach(5);
  servo5.attach(6); 
  servo6.attach(7);
}

// the loop routine runs over and over again forever:
void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);

    if(results.value == Value1) {
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
    }
    else if  (results.value == Value4){ // servo 1-180
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo1.write(180);
    }
    else if  (results.value == Value5){ // servo 1-110
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo1.write(110);
    }
    else if  (results.value == Value6){ // servo 1-90
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo1.write(90);
    } 
    else if  (results.value == Value7){ // servo 2-180
      servo1.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo2.write(180);
    }
    else if  (results.value == Value8){ // servo 2-110
      servo1.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo2.write(110);
    }
    else if  (results.value == Value9){ // servo 2-90
      servo1.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo2.write(90);
    } 
    else if  (results.value == Value10){ // servo 3-180
      servo1.write(0);
      servo2.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo3.write(180);
    }
    else if  (results.value == Value11){ // servo 3-110
      servo1.write(0);
      servo2.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo3.write(110);
    }
    else if  (results.value == Value12){ // servo 3-90
      servo1.write(0);
      servo2.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(0);
      servo3.write(90);
    }
    else if  (results.value == Value13){ // servo 4-180
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo5.write(0);
      servo6.write(0);
      servo4.write(180);
    }
    else if  (results.value == Value14){ // servo 4-110
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo5.write(0);
      servo6.write(0);
      servo4.write(110);
    }
    else if  (results.value == Value15){ // servo 4-90
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo5.write(0);
      servo6.write(0);
      servo4.write(90);
    }
    else if  (results.value == Value16){ // servo 5-180
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo6.write(0);
      servo5.write(180);
    }
    else if  (results.value == Value17){ // servo 5-110
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo6.write(0);
      servo5.write(110);
    }
    else if  (results.value == Value18){ // servo 5-90
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo6.write(0);
      servo5.write(90);
    }
    else if  (results.value == Value19){ // servo 6-180
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(180);
    }
    else if  (results.value == Value20){ // servo 6-110
      servo1.write(0);
      servo2.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo6.write(110);
    }
    else if  (results.value == Value21){ // servo 6-90
      servo1.write(0);
      servo3.write(0);
      servo4.write(0);
      servo5.write(0);
      servo5.write(0);
      servo6.write(90);
    }
    irrecv.resume(); // Receive the next value
  }
}

Why are you double posting?

That just wastes everyone's time.

You are getting the same advice on your other Thread.

...R