Hello!
I'm trying to get the irremote code (see code below) to run on a Teensy 3.2 but having some issues with the following line:
IrReceiver.enableIRIn(); // Start the receiver
the code hangs and won't continue to run. The Serial.println() on the line before writes a string to the serial monitor.
Any ideas of what might be wrong?
HW: Teensy 3.2
Arduino: 1.8.13
Teensyduino: 1.53
/Per
I'm trying to get the irremote code (see code below) to run on a Teensy 3.2 but having some issues with the following line:
IrReceiver.enableIRIn(); // Start the receiver
the code hangs and won't continue to run. The Serial.println() on the line before writes a string to the serial monitor.
Any ideas of what might be wrong?
HW: Teensy 3.2
Arduino: 1.8.13
Teensyduino: 1.53
/Per
Code:
/*
* IRremote: IRreceiveDump - dump details of IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Initially coded 2009 Ken Shirriff http://www.righto.com
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
* LG added by Darryl Smith (based on the JVC protocol)
*/
#include <IRremote.h>
/*
* Default is Arduino pin D11.
* You can change this to another available Arduino Pin.
* Your IR receiver should be connected to the pin defined here
*/
#if defined(ESP32)
int IR_RECEIVE_PIN = 2;
#else
int IR_RECEIVE_PIN = 2;
#endif
IRrecv IrReceiver(IR_RECEIVE_PIN);
// On the Zero and others we switch explicitly to SerialUSB
#if defined(ARDUINO_ARCH_SAMD)
#define Serial SerialUSB
#endif
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL)
delay(2000); // To be able to connect Serial monitor after reset and before first printout
#endif
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__));
IrReceiver.enableIRIn(); // Start the receiver
IrReceiver.blink13(true); // Enable feedback LED
Serial.print(F("Ready to receive IR signals at pin "));
Serial.println(IR_RECEIVE_PIN);
}
void loop() {
if (IrReceiver.decode()) {
Serial.println();
IrReceiver.printIRResultRaw(&Serial);
IrReceiver.resume(); // Receive the next value
}
}