28 lines
660 B
C++
Executable File
28 lines
660 B
C++
Executable File
//Code for finding the IR codesC/C++
|
|
//Remember to install the IRremote library.
|
|
#include <IRremote.h> //including infrared remote header file
|
|
|
|
int RECV_PIN = 11; // the pin where you connect the output pin of IR sensor
|
|
IRrecv irrecv(RECV_PIN);
|
|
decode_results results;
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(9600);
|
|
irrecv.enableIRIn();
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
if (irrecv.decode(&results))
|
|
{
|
|
Serial.println(" ");
|
|
Serial.print("Code: ");
|
|
Serial.println(results.value); //prints the value a a button press
|
|
Serial.println(" ");
|
|
irrecv.resume(); // Receive the next value
|
|
Serial.println("*****************");
|
|
}
|
|
}
|
|
|