IR servo control code. error message can not figure it out. Help please

I get this error message when I try to compile the code;

c:\Program Files\Arduino\libraries\RobotIRremote\scr\IRremotetools.cpp:5:16: error: 'TKD2' was not declared in scope
int RECV_PIN = TKD2; // the pin the ir receiver is connected to

Any help would be most appreciated. I am new at this but trying.

I am trying to control a servo with the remote control that came in the kit.
Thanks

Am I supposed to just guess at what this code looks like?

Don’t you think it would help to show the code that caused the error?

Sorry about that…

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

unsigned long Value1 = 0xFFA25D; // where XXXXXXXX is on our your remote’s values
unsigned long Value2 = 0xFF629D; // where XXXXXXXX is another button on your remote

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

Servo servo1;

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

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

// initialize the digital pin as an output.

servo1.attach(10); // attack servo to digital pin 10
}

// the loop routine runs over and over again forever:
void loop() {

if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}

if(results.value == Value1) {
servo1.write(160);
}
else if (results.value == Value2){
servo1.write(75);
}
}

If you put [ code] and [ /code] (without those spaces) around your code, it will format it and look much prettier for us. :slight_smile:

A very tiny little bit of google and I was able to come up with this:

Almost to the bottom of comments:

This issue is caused by someone changing the stock library to suit the RS Components robot board on which the pins are called TK whatever so TKD2 is a pin on that robot board . Now this interferes with the examples and the library must be deleted and replaced for it to compile properly.

Arduino 1.5.8 wrongly includes this adulterated library as RobotIRRemote. It needs to be replaced with the original correct IRRemote library in the next releases

Delta_G:
A very tiny little bit of google and I was able to come up with this:

'TKD2' was not declared in this scope · Issue #98 · Arduino-IRremote/Arduino-IRremote · GitHub

Almost to the bottom of comments:

I have had the issue he is having.

Here's what you can do - try this:

Delete (or move out of the Library folder to keep as backup) the RobotIRRemote folder. Then, get this one from github. That should work.

Alternatively, from the RobotIRRemote/src folder, delete (or, again, move out of the libraries folder) "IRRemotetools.cpp" and "IRremotetools.h".

Thank you for your Help.

How can I get rid of this "RobotIRremote" folder. When I open libraries the folder does not seem to exist.
But if I open sketches-libraries-I find it, but can not delete it...
Any sugestions?

There are two library folders. One is in your sketchbook folder and the other is in the folder where Arduino is installed.

Thank you that helped.
I was able to remove the file. Now I just need to add the new library.

Sorry but for some reason I can not get this to work. I have unzipped the IR files into the libraries folder and the sketch still does not work.
Any suggestions?

Rustybot:
Sorry but for some reason I can not get this to work. I have unzipped the IR files into the libraries folder and the sketch still does not work.
Any suggestions?

Define "still does not work". Same error?

I am happy to say that after several hours of playing, I finally got my IR remote to operate the servo/
The problem was the library not having the right IR information.
I was not loading the correct IR library into the program.
With the help of you all here, I was able to figure out how to do this, then it worked.
I am new to this and I do thank you for your help.
IT is going to be an interesting hobby!