mirror of
https://github.com/Theaninova/Arduino-IRremote.git
synced 2025-12-11 00:46:14 +00:00
- fixed indenting on existing code in a few places for consistency - introduced IR_TIMER_USE_ESP32 for ifdefs within the code as per request - added comments explaining what's missing for irsend support on ESP32 - IRrecvDemo.ino gets a warning before and after interrupt is enabled in case it causes a crash TESTED=IoTuz ESP32 board and original 328p arduino to make sure current code did not break.
34 lines
726 B
C++
34 lines
726 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>
|
|
|
|
int RECV_PIN = 11;
|
|
|
|
IRrecv irrecv(RECV_PIN);
|
|
|
|
decode_results results;
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(9600);
|
|
// In case the interrupt driver crashes on setup, give a clue
|
|
// to the user what's going on.
|
|
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);
|
|
}
|