mirror of
https://github.com/Theaninova/Arduino-IRremote.git
synced 2025-12-11 08:56:14 +00:00
- disable a lot of defines not relevant to ESP32, set them to 1 (no-op) - change default IR pin to 35 from 11 - changed serial speed to 115200 (9600 is too slow to keep up with IR input) - irSend disables code that will not compile on ESP32. It won't work, but it won't break compilation either.
36 lines
675 B
C++
36 lines
675 B
C++
/*
|
|
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
|
|
* An IR detector/demodulator must be connected to the input RECV_PIN.
|
|
* Version 0.1 July, 2009
|
|
* Copyright 2009 Ken Shirriff
|
|
* http://arcfn.com
|
|
*/
|
|
|
|
#include <IRremote.h>
|
|
|
|
#ifdef ESP32
|
|
int RECV_PIN = 35;
|
|
#else
|
|
int RECV_PIN = 11;
|
|
#endif
|
|
|
|
IRrecv irrecv(RECV_PIN);
|
|
|
|
decode_results results;
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(115200);
|
|
Serial.println("Enabling IRin");
|
|
irrecv.enableIRIn(); // Start the receiver
|
|
Serial.println("Enabled IRin");
|
|
}
|
|
|
|
void loop() {
|
|
if (irrecv.decode(&results)) {
|
|
Serial.println(results.value, HEX);
|
|
irrecv.resume(); // Receive the next value
|
|
}
|
|
delay(100);
|
|
}
|