apuntes_Arduino/sensores/ir/ir_receiver2/ir_receiver2.ino

24 lines
682 B
Arduino
Raw Normal View History

2021-01-05 00:15:16 -03:00
//Code for finding the IR codesC/C++
//Remember to install the IRremote library.
#include <IRremote.h> //including infrared remote header file
2024-01-16 13:40:01 -03:00
int RECV_PIN = 8; // the pin where you connect the output pin of IR sensor
2021-01-05 00:15:16 -03:00
IRrecv irrecv(RECV_PIN);
decode_results results;
2022-04-04 17:41:38 -04:00
void setup() {
Serial.begin(9600);
irrecv.enableIRIn();
2021-01-05 00:15:16 -03:00
}
2022-04-04 17:41:38 -04:00
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("*****************");
2021-01-05 00:15:16 -03:00
}
}