Demo doesn't work...

I have the demo:

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

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

and get the Error:

C:\Program Files (x86)\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp:5:16: error: ‘TKD2’ was not declared in this scope
int RECV_PIN = TKD2; // the pin the IR receiver is connected to
^
Error while translating

The code you posted compiles for me: where does that TKD2 come from?

From:
C:\Program Files (x86)\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp

#include "IRremote.h"
#include "IRremoteTools.h"
#include <Arduino.h>

int RECV_PIN = TKD2; // the pin the IR receiver is connected to
IRrecv irrecv(RECV_PIN); // an instance of the IR receiver object
decode_results results; // container for received IR codes

void beginIRremote(){
	irrecv.enableIRIn(); // Start the receiver
}

bool IRrecived(){
	return irrecv.decode(&results);
}

void resumeIRremote(){
    irrecv.resume(); // resume receiver
}

unsigned long getIRresult(){
	return results.value;
}

Line 5:
int RECV_PIN = TKD2; // the pin the IR receiver is connected to

Well, somewhere in that code you need to tell it what TKD2 is supposed to be. I'm assuming by the fact that it is all caps that it should be #define'd somewhere in your sketch. Put that in and see what you get.

That's not my sketch if you look at the Path it is an library generated by the Arduino IDE...

It's working now just deleted IRremoteTools.cpp :)

I don't care who wrote the code. It's still missing a #define.

The IDE doesn't generate any libraries. There are some that come with it, but they were written by people too.

Hi, what I'm surprised about is that the OP is that good, that he posts a working sketch, which is supposed to produce errors. Then posts the faulty post, without explaining what the first one was.

int RECV_PIN = TKD2; // the pin the IR receiver is connected to

Now TKD2, the comment beside it says that is the IR input pin, which the OP has to define

int TKD2= pinnumber;

The OP took no notice of the advice suggested by DeltaG.

The OP doesn't even say what the sketch is supposed to do.

Sorry but thats my New Year Rant. 7:25, 1/1/2015 Happy New Year

Tom...... :)

Delta_G: Well, somewhere in that code you need to tell it what TKD2 is supposed to be. I'm assuming by the fact that it is all caps that it should be #define'd somewhere in your sketch. Put that in and see what you get.

well i tried to define TKD2 and got this: Arduino: 1.6.1 (Windows 7), Board: "Arduino Uno"

java.lang.NullPointerException

at processing.app.BaseNoGui.removeDescendants(BaseNoGui.java:832)

at processing.app.BaseNoGui.removeDir(BaseNoGui.java:854)

at processing.app.Base.removeDir(Base.java:2314)

at processing.app.Sketch.saveAs(Sketch.java:711)

at processing.app.Editor.handleSaveAs(Editor.java:2343)

at processing.app.Editor.handleSave(Editor.java:2284)

at processing.app.Editor.handleExport(Editor.java:2410)

at processing.app.EditorToolbar.mousePressed(EditorToolbar.java:349)

at java.awt.Component.processMouseEvent(Component.java:6522)

at javax.swing.JComponent.processMouseEvent(JComponent.java:3322)

at java.awt.Component.processEvent(Component.java:6290)

at java.awt.Container.processEvent(Container.java:2234)

at java.awt.Component.dispatchEventImpl(Component.java:4881)

at java.awt.Container.dispatchEventImpl(Container.java:2292)

at java.awt.Component.dispatchEvent(Component.java:4703)

at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4530)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)

at java.awt.Container.dispatchEventImpl(Container.java:2278)

at java.awt.Window.dispatchEventImpl(Window.java:2739)

at java.awt.Component.dispatchEvent(Component.java:4703)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:751)

at java.awt.EventQueue.access$500(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:702)

at java.awt.EventQueue$3.run(EventQueue.java:696)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)

at java.awt.EventQueue$4.run(EventQueue.java:724)

at java.awt.EventQueue$4.run(EventQueue.java:722)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:721)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

sketch_apr20a.ino:3:14: error: expected primary-expression before '=' token

sketch_apr20a.ino:5:16: note: in expansion of macro 'TKD2'

Error compiling.

This report would have more information with "Show verbose output during compilation" enabled in File > Preferences.

Why are you resurrecting a 3 1/2 months old thread?

Hi

the lib in Arduino 1.0.6 etc have been changed to accommodate the IR Robot stuff and someone has changed the standard ref to TK into TKD2.

If you are not using the robot kit remove the RobotIRremote folder form the standard library folder and it should work.

Cheers

That last error listing indicated his target board that he tried to compile to is the UNO... If he is trying to compile an example for the Arduino robot, why isn't that his target board?

Maybe the board definitions for the robot define where "TKD2" is? Just like the board definition for the UNO defines where "A2" is.