Hello all
I have a Teensy 3.2 here, and trying to get the IRremote library working. Used it before, but the latest update is now so madly complicated with 'USE_DEFAULT_FEEDBACK_LED_PIN' and 'ENABLE_LED_FEEDBACK' etc, that I just cannot get it working. No idea why the example called 'Simple Receiver' is anything but
It fails to initialise the IR at line 59 (I have changed the pin definitions in "PinDefinitionsAndMore.h"). I am using pin 26 as my IR input.
Why it needs to be so complicated I don't know. Can I not get this thing working without the baggage of the "PinDefinitionsAndMore.h" file? I tried to remove it and no-go.
Tried a few other libraries IRlib and IRLib2 and they both had timer issues I believe (both threw up TCNT2 errors?).
Don't want to go backwards to a Pro-Mini, but at least that worked.
In the definitions code:
Any idea what would stop it initialising and what are all these extra pin definitions for? 'SimpleReceiver!!!!!!" (I know I am a bit thick and all that)
I have a Teensy 3.2 here, and trying to get the IRremote library working. Used it before, but the latest update is now so madly complicated with 'USE_DEFAULT_FEEDBACK_LED_PIN' and 'ENABLE_LED_FEEDBACK' etc, that I just cannot get it working. No idea why the example called 'Simple Receiver' is anything but
It fails to initialise the IR at line 59 (I have changed the pin definitions in "PinDefinitionsAndMore.h"). I am using pin 26 as my IR input.
Why it needs to be so complicated I don't know. Can I not get this thing working without the baggage of the "PinDefinitionsAndMore.h" file? I tried to remove it and no-go.
Tried a few other libraries IRlib and IRLib2 and they both had timer issues I believe (both threw up TCNT2 errors?).
Don't want to go backwards to a Pro-Mini, but at least that worked.
Code:
/*
* SimpleReceiver.cpp
*
* Demonstrates receiving NEC IR codes with IRrecv
*
* Copyright (C) 2020-2021 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
*
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* MIT License
*/
/*
* Specify which protocol(s) should be used for decoding.
* If no protocol is defined, all protocols are active.
*/
//#define DECODE_DENON // Includes Sharp
//#define DECODE_JVC
//#define DECODE_KASEIKYO
//#define DECODE_PANASONIC // the same as DECODE_KASEIKYO
//#define DECODE_LG
#define DECODE_NEC // Includes Apple and Onkyo
//#define DECODE_SAMSUNG
//#define DECODE_SONY
//#define DECODE_RC5
//#define DECODE_RC6
//#define DECODE_BOSEWAVE
//#define DECODE_LEGO_PF
//#define DECODE_MAGIQUEST
//#define DECODE_WHYNTER
//#define DECODE_DISTANCE // universal decoder for pulse width or pulse distance protocols
//#define DEBUG // Activate this for lots of lovely debug output from the decoders.
//#define INFO // To see valuable informations from universal decoder for pulse width or pulse distance protocols
//#define DECODE_HASH // special decoder for all protocols
#include <Arduino.h>
/*
* Define macros for input and output pin etc.
*/
#include "PinDefinitionsAndMore.h"
#include <IRremote.hpp>
void setup() {
delay(3000);
Serial.begin(115200);
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
/*
* Start the receiver, enable feedback LED and take LED feedback pin from the internal boards definition
*/
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK, USE_DEFAULT_FEEDBACK_LED_PIN);
Serial.print(F("Ready to receive IR signals of protocols: "));
printActiveIRProtocols(&Serial);
Serial.print(F("at pin "));
Serial.println(IR_RECEIVE_PIN);
}
void loop() {
/*
* Check if received data is available and if yes, try to decode it.
* Decoded result is in the IrReceiver.decodedIRData structure.
*
* E.g. command is in IrReceiver.decodedIRData.command
* address is in command is in IrReceiver.decodedIRData.address
* and up to 32 bit raw data in IrReceiver.decodedIRData.decodedRawData
*/
if (IrReceiver.decode()) {
// Print a short summary of received data
IrReceiver.printIRResultShort(&Serial);
if (IrReceiver.decodedIRData.protocol == UNKNOWN) {
// We have an unknown protocol here, print more info
IrReceiver.printIRResultRawFormatted(&Serial, true);
}
Serial.println();
/*
* !!!Important!!! Enable receiving of the next value,
* since receiving has stopped after the end of the current received data packet.
*/
IrReceiver.resume(); // Enable receiving of the next value
/*
* Finally, check the received data and perform actions according to the received command
*/
if (IrReceiver.decodedIRData.command == 0x10) {
// do something
} else if (IrReceiver.decodedIRData.command == 0x11) {
// do something else
}
}
}
In the definitions code:
Code:
#elif defined(TEENSYDUINO)
#define IR_RECEIVE_PIN 26
#define IR_SEND_PIN 31
#define TONE_PIN 4
#define APPLICATION_PIN 5
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6
#define _IR_TIMING_TEST_PIN 7
Any idea what would stop it initialising and what are all these extra pin definitions for? 'SimpleReceiver!!!!!!" (I know I am a bit thick and all that)