51 lines
2.1 KiB
C++
51 lines
2.1 KiB
C++
/*
|
|
* IRremoteExtensionTest.cpp
|
|
* Simple test using the IRremoteExtensionClass.
|
|
*/
|
|
#include <Arduino.h>
|
|
|
|
#if RAMEND <= 0x4FF || (defined(RAMSIZE) && RAMSIZE < 0x4FF)
|
|
#define RAW_BUFFER_LENGTH 180 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
|
|
#elif RAMEND <= 0x8FF || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
|
|
#define RAW_BUFFER_LENGTH 500 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
|
|
#else
|
|
#define RAW_BUFFER_LENGTH 750 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
|
|
#endif
|
|
|
|
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
|
|
#include <IRremote.hpp>
|
|
|
|
#include "IRremoteExtensionClass.h"
|
|
|
|
/*
|
|
* Create the class, which itself uses the IRrecv class from IRremote
|
|
*/
|
|
IRExtensionClass IRExtension(&IrReceiver);
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/|| defined(SERIALUSB_PID) || defined(ARDUINO_attiny3217)
|
|
delay(4000); // To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!
|
|
#endif
|
|
// 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 and if not 3. parameter specified, take LED_BUILTIN pin from the internal boards definition as default feedback LED
|
|
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
|
|
|
|
|
|
Serial.print(F("Ready to receive IR signals of protocols: "));
|
|
printActiveIRProtocols(&Serial);
|
|
Serial.println(F("at pin " STR(IR_RECEIVE_PIN)));
|
|
|
|
}
|
|
|
|
void loop() {
|
|
if (IrReceiver.decode()) {
|
|
IrReceiver.printIRResultShort(&Serial);
|
|
IrReceiver.printIRSendUsage(&Serial);
|
|
IRExtension.resume(); // Use the extended function
|
|
}
|
|
delay(100);
|
|
}
|