Ir Reciver

hi

I keep on trying to use an ir receiver. but I keep on getting this error message

/Users/lorenzo/Documents/Arduino/ir_reciver/ir_reciver.ino:1:22: fatal error: IRremote.h: No such file or directory
#include "IRremote.h"
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

this is the code

#include "IRremote.h"

int receiver = 11; // Signal Pin of IR receiver to Arduino Digital Pin 11

/-----( Declare objects )-----/
IRrecv irrecv(receiver); // create instance of 'irrecv'
decode_results results; // create instance of 'decode_results'

void setup() /----( SETUP: RUNS ONCE )----/
{
Serial.begin(9600);
Serial.println("IR Receiver Button Decode");
irrecv.enableIRIn(); // Start the receiver

}/--(end setup )---/

void loop() /----( LOOP: RUNS CONSTANTLY )----/
{
if (irrecv.decode(&results)) // have we received an IR signal?

{
translateIR();
irrecv.resume(); // receive the next value
}
}/* --(end main loop )-- */

/-----( Function )-----/
void translateIR() // takes action based on IR code received

// describing Remote IR codes

{

switch(results.value)

{

case 0xFF629D: Serial.println(" FORWARD"); break;
case 0xFF22DD: Serial.println(" LEFT"); break;
case 0xFF02FD: Serial.println(" -OK-"); break;
case 0xFFC23D: Serial.println(" RIGHT"); break;
case 0xFFA857: Serial.println(" REVERSE"); break;
case 0xFF6897: Serial.println(" 1"); break;
case 0xFF9867: Serial.println(" 2"); break;
case 0xFFB04F: Serial.println(" 3"); break;
case 0xFF30CF: Serial.println(" 4"); break;
case 0xFF18E7: Serial.println(" 5"); break;
case 0xFF7A85: Serial.println(" 6"); break;
case 0xFF10EF: Serial.println(" 7"); break;
case 0xFF38C7: Serial.println(" 8"); break;
case 0xFF5AA5: Serial.println(" 9"); break;
case 0xFF42BD: Serial.println(" *"); break;
case 0xFF4AB5: Serial.println(" 0"); break;
case 0xFF52AD: Serial.println(" #"); break;
case 0xFFFFFFFF: Serial.println(" REPEAT");break;

default:
Serial.println(" other button ");

}// End Case

delay(500); // Do not get immediate repeat

}

Did you install the library?

IRremote.h: No such file or directory

Do you have that file and if so where is it located on your PC ?

#include "IRremote.h"

Implies that it is in the same folder as the sketch, but is it ?

If you used this instead

#include <IRremote.h>

it would imply that it was in the libraries folder.

I put in the library then this error message came up

Build options changed, rebuilding all
/private/var/folders/5l/bv3qxm_d7f148z7ry2z6k56h0000gq/T/AppTranslocation/D39E1577-02AD-42CC-BF2F-77F50AB7A890/d/Arduino-3.app/Contents/Resources/Java/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 compiling.

Which Arduino board are you using and is it set correctly in the IDE menu ?

Lorenzogrosso06:
I put in the library then this error message came up

Try to follow a tutorial on IR and see if you can make it work

I did

Lorenzogrosso06:
I did

Can you mark the thread "solved" then, please?