удалила лишнее из примеров

This commit is contained in:
KLASSENTS 2025-01-23 10:25:49 +07:00
parent 2889721109
commit 8a0cc3dded
13 changed files with 145 additions and 772 deletions

View File

@ -46,7 +46,6 @@
*/ */
#include <Arduino.h> #include <Arduino.h>
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
/* /*
* Specify which protocol(s) should be used for decoding. * Specify which protocol(s) should be used for decoding.
@ -72,11 +71,8 @@
// //
#if !defined(RAW_BUFFER_LENGTH) #if !defined(RAW_BUFFER_LENGTH)
// For air condition remotes it requires 750. Default is 200.
# if !((defined(RAMEND) && RAMEND <= 0x4FF) || (defined(RAMSIZE) && RAMSIZE < 0x4FF))
#define RAW_BUFFER_LENGTH 750 #define RAW_BUFFER_LENGTH 750
#endif #endif
#endif
//#define EXCLUDE_UNIVERSAL_PROTOCOLS // Saves up to 1000 bytes program memory. //#define EXCLUDE_UNIVERSAL_PROTOCOLS // Saves up to 1000 bytes program memory.
//#define EXCLUDE_EXOTIC_PROTOCOLS // saves around 650 bytes program memory if all other protocols are active //#define EXCLUDE_EXOTIC_PROTOCOLS // saves around 650 bytes program memory if all other protocols are active
@ -91,9 +87,20 @@
//#define DEBUG // Activate this for lots of lovely debug output from the decoders. //#define DEBUG // Activate this for lots of lovely debug output from the decoders.
#define IR_RECEIVE_PIN 4
#define IR_SEND_PIN 3
/*
* Helper macro for getting a macro definition as string
*/
#if !defined(STR_HELPER)
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#endif
#include <IRremote.hpp> #include <IRremote.hpp>
int SEND_BUTTON_PIN = APPLICATION_PIN; int SEND_BUTTON_PIN = BTN_BUILTIN;
int DELAY_BETWEEN_REPEAT = 50; int DELAY_BETWEEN_REPEAT = 50;
@ -113,14 +120,10 @@ void sendCode(storedIRDataStruct *aIRDataToSend);
void setup() { void setup() {
pinMode(SEND_BUTTON_PIN, INPUT_PULLUP); pinMode(SEND_BUTTON_PIN, INPUT_PULLUP);
Serial.begin(115200); Serial.begin(9600);
while (!Serial) while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores. ; // Wait for Serial to become available. Is optimized away for some cores.
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || 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 // Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE)); Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
@ -130,7 +133,7 @@ void setup() {
printActiveIRProtocols(&Serial); printActiveIRProtocols(&Serial);
Serial.println(F("at pin " STR(IR_RECEIVE_PIN))); Serial.println(F("at pin " STR(IR_RECEIVE_PIN)));
IrSender.begin(); // Start with IR_SEND_PIN -which is defined in PinDefinitionsAndMore.h- as send pin and enable feedback LED at default feedback LED pin IrSender.begin(); // Start with IR_SEND_PIN as send pin and enable feedback LED at default feedback LED pin
Serial.print(F("Ready to send IR signals at pin " STR(IR_SEND_PIN) " on press of button at pin ")); Serial.print(F("Ready to send IR signals at pin " STR(IR_SEND_PIN) " on press of button at pin "));
Serial.println(SEND_BUTTON_PIN); Serial.println(SEND_BUTTON_PIN);
} }
@ -139,6 +142,8 @@ void loop() {
// If button pressed, send the code. // If button pressed, send the code.
bool tSendButtonIsActive = (digitalRead(SEND_BUTTON_PIN) == LOW); // Button pin is active LOW bool tSendButtonIsActive = (digitalRead(SEND_BUTTON_PIN) == LOW); // Button pin is active LOW
if (digitalRead(SEND_BUTTON_PIN))
Serial.println("pressed");
/* /*
* Check for current button state * Check for current button state

View File

@ -46,24 +46,31 @@
*/ */
#include <Arduino.h> #include <Arduino.h>
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#if !defined(IR_SEND_PIN) #if !defined(IR_SEND_PIN)
#define IR_SEND_PIN 3 #define IR_SEND_PIN 3
#endif #endif
#define IR_RECEIVE_PIN 4
#define BTN_ACTIVE_STATE HIGH
/*
* Helper macro for getting a macro definition as string
*/
#if !defined(STR_HELPER)
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#endif
/* /*
* Specify DistanceWidthProtocol for decoding. This must be done before the #include <IRremote.hpp> * Specify DistanceWidthProtocol for decoding. This must be done before the #include <IRremote.hpp>
*/ */
#define DECODE_DISTANCE_WIDTH // Universal decoder for pulse distance width protocols #define DECODE_DISTANCE_WIDTH // Universal decoder for pulse distance width protocols
// //
#if !defined(RAW_BUFFER_LENGTH) #if !defined(RAW_BUFFER_LENGTH)
// For air condition remotes it requires 750. Default is 200.
# if (defined(RAMEND) && RAMEND <= 0x4FF) || (defined(RAMSIZE) && RAMSIZE < 0x4FF)
#define RAW_BUFFER_LENGTH 360
# elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
#define RAW_BUFFER_LENGTH 750 #define RAW_BUFFER_LENGTH 750
#endif #endif
#endif
//#define NO_LED_FEEDBACK_CODE // saves 92 bytes program memory //#define NO_LED_FEEDBACK_CODE // saves 92 bytes program memory
//#define RECORD_GAP_MICROS 12000 // Default is 8000. Activate it for some LG air conditioner protocols //#define RECORD_GAP_MICROS 12000 // Default is 8000. Activate it for some LG air conditioner protocols
@ -74,7 +81,7 @@
#include <IRremote.hpp> #include <IRremote.hpp>
#define SEND_BUTTON_PIN APPLICATION_PIN #define SEND_BUTTON_PIN BTN_BUILTIN
#define DELAY_BETWEEN_REPEATS_MILLIS 70 #define DELAY_BETWEEN_REPEATS_MILLIS 70
@ -88,14 +95,10 @@ bool sSendButtonWasActive;
void setup() { void setup() {
pinMode(SEND_BUTTON_PIN, INPUT_PULLUP); pinMode(SEND_BUTTON_PIN, INPUT_PULLUP);
Serial.begin(115200); Serial.begin(9600);
while (!Serial) while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores. ; // Wait for Serial to become available. Is optimized away for some cores.
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || 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 // Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE)); Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
@ -111,7 +114,7 @@ void setup() {
void loop() { void loop() {
// If button pressed, send the code. // If button pressed, send the code.
bool tSendButtonIsActive = (digitalRead(SEND_BUTTON_PIN) == LOW); // Button pin is active LOW bool tSendButtonIsActive = (digitalRead(SEND_BUTTON_PIN) == BTN_ACTIVE_STATE);
/* /*
* Check for current button state * Check for current button state

View File

@ -1,349 +0,0 @@
/*
* PinDefinitionsAndMore.h
*
* Contains pin definitions for IRremote examples for various platforms
* as well as definitions for feedback LED and tone() and includes
*
* Copyright (C) 2021-2023 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
*
* This file is part of IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* Arduino-IRremote is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
*
*/
/*
* Pin mapping table for different platforms
*
* Platform IR input IR output Tone Core/Pin schema
* --------------------------------------------------------------
* DEFAULT/AVR 2 3 4 Arduino
* ATtinyX5 0|PB0 4|PB4 3|PB3 ATTinyCore
* ATtiny167 3|PA3 2|PA2 7|PA7 ATTinyCore
* ATtiny167 9|PA3 8|PA2 5|PA7 Digispark original core
* ATtiny84 |PB2 |PA4 |PA3 ATTinyCore
* ATtiny88 3|PD3 4|PD4 9|PB1 ATTinyCore
* ATtiny3217 18|PA1 19|PA2 20|PA3 MegaTinyCore
* ATtiny1604 2 3|PA5 %
* ATtiny816 14|PA1 16|PA3 1|PA5 MegaTinyCore
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 2 3 4
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/
//#define _IR_MEASURE_TIMING // For debugging purposes.
#if defined(__AVR__)
#if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) // Digispark board. For use with ATTinyCore.
#include "ATtinySerialOut.hpp" // TX is at pin 2 - Available as Arduino library "ATtinySerialOut". Saves 700 bytes program memory and 70 bytes RAM for ATtinyCore.
#define IR_RECEIVE_PIN PIN_PB0
#define IR_SEND_PIN PIN_PB4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
#define TONE_PIN PIN_PB3
#define _IR_TIMING_TEST_PIN PIN_PB3
# elif defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__) // Digispark pro board
#include "ATtinySerialOut.hpp" // Available as Arduino library "ATtinySerialOut"
// For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.
# if defined(ARDUINO_AVR_DIGISPARKPRO)
// For use with Digispark original core
#define IR_RECEIVE_PIN 9 // PA3 - on Digispark board labeled as pin 9
//#define IR_RECEIVE_PIN 14 // PB6 / INT0 is connected to USB+ on DigisparkPro boards
#define IR_SEND_PIN 8 // PA2 - on Digispark board labeled as pin 8
#define TONE_PIN 5 // PA7 - on Digispark board labeled as pin 5
#define _IR_TIMING_TEST_PIN 10 // PA4
# else
// For use with ATTinyCore
#define IR_RECEIVE_PIN PIN_PA3 // On Digispark board labeled as pin 9 - INT0 is connected to USB+ on DigisparkPro boards
#define IR_SEND_PIN PIN_PA2 // On Digispark board labeled as pin 8
#define TONE_PIN PIN_PA7 // On Digispark board labeled as pin 5
# endif
# elif defined(__AVR_ATtiny84__) // For use with ATTinyCore
#include "ATtinySerialOut.hpp" // Available as Arduino library "ATtinySerialOut". Saves 128 bytes program memory.
#define IR_RECEIVE_PIN PIN_PB2 // INT0
#define IR_SEND_PIN PIN_PA4
#define TONE_PIN PIN_PA3
#define _IR_TIMING_TEST_PIN PIN_PA5
# elif defined(__AVR_ATtiny88__) // MH-ET Tiny88 board. For use with ATTinyCore.
#include "ATtinySerialOut.hpp" // Available as Arduino library "ATtinySerialOut". Saves 128 bytes program memory.
// Pin 6 is TX, pin 7 is RX
#define IR_RECEIVE_PIN PIN_PD3 // 3 - INT1
#define IR_SEND_PIN PIN_PD4 // 4
#define TONE_PIN PIN_PB1 // 9
#define _IR_TIMING_TEST_PIN PIN_PB0 // 8
# elif defined(__AVR_ATtiny1616__) || defined(__AVR_ATtiny3216__) || defined(__AVR_ATtiny3217__) // For use with megaTinyCore
// Tiny Core Dev board
// https://www.tindie.com/products/xkimi/tiny-core-16-dev-board-attiny1616/ - Out of Stock
// https://www.tindie.com/products/xkimi/tiny-core-32-dev-board-attiny3217/ - Out of Stock
#define IR_RECEIVE_PIN PIN_PA1 // use 18 instead of PIN_PA1 for TinyCore32
#define IR_SEND_PIN PIN_PA2 // 19
#define TONE_PIN PIN_PA3 // 20
#define APPLICATION_PIN PIN_PA0 // 0
#undef LED_BUILTIN // No LED available on the TinyCore 32 board, take the one on the programming board which is connected to the DAC output
#define LED_BUILTIN PIN_PA6 // use 2 instead of PIN_PA6 for TinyCore32
# elif defined(__AVR_ATtiny816__) // For use with megaTinyCore
#define IR_RECEIVE_PIN PIN_PA1 // 14
#define IR_SEND_PIN PIN_PA1 // 16
#define TONE_PIN PIN_PA5 // 1
#define APPLICATION_PIN PIN_PA4 // 0
#undef LED_BUILTIN // No LED available, take the one which is connected to the DAC output
#define LED_BUILTIN PIN_PB5 // 4
# elif defined(__AVR_ATtiny1614__) // For use with megaTinyCore
#define IR_RECEIVE_PIN PIN_PA1 // 8
#define IR_SEND_PIN PIN_PA3 // 10
#define TONE_PIN PIN_PA5 // 1
#define APPLICATION_PIN PIN_PA4 // 0
# elif defined(__AVR_ATtiny1604__) // For use with megaTinyCore
#define IR_RECEIVE_PIN PIN_PA6 // 2 - To be compatible with interrupt example, pin 2 is chosen here.
#define IR_SEND_PIN PIN_PA7 // 3
#define APPLICATION_PIN PIN_PB2 // 5
#define tone(...) void() // Define as void, since TCB0_INT_vect is also used by tone()
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
# elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \
|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \
|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \
|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \
|| defined(__AVR_ATmega164P__) || defined(__AVR_ATmega32__) \
|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) \
|| defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) \
|| defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) \
|| defined(__AVR_ATmega8515__) || defined(__AVR_ATmega162__)
#define IR_RECEIVE_PIN 2
#define IR_SEND_PIN 13
#define TONE_PIN 4
#define APPLICATION_PIN 5
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
#define _IR_TIMING_TEST_PIN 7
# else // Default as for ATmega328 like on Uno, Nano, Leonardo, Teensy 2.0 etc.
#define IR_RECEIVE_PIN 2 // To be compatible with interrupt example, pin 2 is chosen here.
#define IR_SEND_PIN 3
#define TONE_PIN 4
#define APPLICATION_PIN 5
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
#define _IR_TIMING_TEST_PIN 7
# if defined(ARDUINO_AVR_PROMICRO) // Sparkfun Pro Micro is __AVR_ATmega32U4__ but has different external circuit
// We have no built in LED at pin 13 -> reuse RX LED
#undef LED_BUILTIN
#define LED_BUILTIN LED_BUILTIN_RX
# endif
# endif // defined(__AVR_ATtiny25__)...
#elif defined(ARDUINO_ARCH_RENESAS_UNO) // Uno R4
// To be compatible with Uno R3.
#define IR_RECEIVE_PIN 2
#define IR_SEND_PIN 3
#define TONE_PIN 4
#define APPLICATION_PIN 5
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
#define _IR_TIMING_TEST_PIN 7
#elif defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/pin 2 is internal LED
#define _IR_TIMING_TEST_PIN 2 // D4
#define APPLICATION_PIN 13 // D7
#define tone(...) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it#
#elif defined(ARDUINO_NOLOGO_ESP32C3_SUPER_MINI)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D8) is active LOW
#define IR_RECEIVE_PIN 2
#define IR_SEND_PIN 3
#define TONE_PIN 4
#define APPLICATION_PIN 10
#elif defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ARDUINO_ESP32C3_DEV)
#define NO_LED_FEEDBACK_CODE // The WS2812 on pin 8 of AI-C3 board crashes if used as receive feedback LED, other I/O pins are working...
#define IR_RECEIVE_PIN 6
#define IR_SEND_PIN 7
#define TONE_PIN 10
#define APPLICATION_PIN 18
#elif defined(ESP32)
#include <Arduino.h>
// tone() is included in ESP32 core since 2.0.2
#if !defined(ESP_ARDUINO_VERSION_VAL)
#define ESP_ARDUINO_VERSION_VAL(major, minor, patch) 12345678
#endif
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
void tone(uint8_t aPinNumber, unsigned int aFrequency){
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
ledcWriteTone(TONE_LEDC_CHANNEL, aFrequency);
}
void tone(uint8_t aPinNumber, unsigned int aFrequency, unsigned long aDuration){
ledcAttachPin(aPinNumber, TONE_LEDC_CHANNEL);
ledcWriteTone(TONE_LEDC_CHANNEL, aFrequency);
delay(aDuration);
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
}
void noTone(uint8_t aPinNumber){
ledcWriteTone(TONE_LEDC_CHANNEL, 0);
}
#endif // ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2, 0, 2)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define TONE_PIN 27 // D27 25 & 26 are DAC0 and 1
#define APPLICATION_PIN 16 // RX2 pin
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1) // BluePill
// Timer 3 blocks PA6, PA7, PB0, PB1 for use by Servo or tone()
#define IR_RECEIVE_PIN PA6
#define IR_RECEIVE_PIN_STRING "PA6"
#define IR_SEND_PIN PA7
#define IR_SEND_PIN_STRING "PA7"
#define TONE_PIN PA3
#define _IR_TIMING_TEST_PIN PA5
#define APPLICATION_PIN PA2
#define APPLICATION_PIN_STRING "PA2"
# if defined(ARDUINO_GENERIC_STM32F103C) || defined(ARDUINO_BLUEPILL_F103C8)
// BluePill LED is active low
#define FEEDBACK_LED_IS_ACTIVE_LOW
# endif
#elif defined(ARDUINO_ARCH_APOLLO3) // Sparkfun Apollo boards
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO) // Arduino Nano 33 BLE and Arduino Nano Connect layout for MBED
// Must be before ARDUINO_ARCH_RP2040, since it is the layout for the MBED core of Arduino Nano Connect
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
#define IR_SEND_PIN 4 // GPIO16
#define TONE_PIN 5
#define APPLICATION_PIN 6
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
#define _IR_TIMING_TEST_PIN 8
#elif defined(ARDUINO_ARCH_RP2040) // Arduino Nano Connect, Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
#define IR_RECEIVE_PIN 15 // GPIO15 to be compatible with the Arduino Nano RP2040 Connect (pin3)
#define IR_SEND_PIN 16 // GPIO16
#define TONE_PIN 17
#define APPLICATION_PIN 18
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
#define _IR_TIMING_TEST_PIN 20
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
// and use the external reset with 1 kOhm to ground to enter UF2 mode
#undef LED_BUILTIN
#define LED_BUILTIN 6
#elif defined(PARTICLE) // !!!UNTESTED!!!
#define IR_RECEIVE_PIN A4
#define IR_SEND_PIN A5 // Particle supports multiple pins
#define LED_BUILTIN D7
/*
* 4 times the same (default) layout for easy adaption in the future
*/
#elif defined(TEENSYDUINO) // Teensy 2.0 is handled at default for ATmega328 like on Uno, Nano, Leonardo etc.
#define IR_RECEIVE_PIN 2
#define IR_SEND_PIN 3
#define TONE_PIN 4
#define APPLICATION_PIN 5
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
#define _IR_TIMING_TEST_PIN 7
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
#define IR_RECEIVE_PIN 2
#define IR_SEND_PIN 3
#define TONE_PIN 4
#define APPLICATION_PIN 5
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
#define _IR_TIMING_TEST_PIN 7
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
#define IR_RECEIVE_PIN 2
#define IR_SEND_PIN 3
#define TONE_PIN 4
#define APPLICATION_PIN 5
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
#define _IR_TIMING_TEST_PIN 7
#if !defined(ARDUINO_SAMD_ADAFRUIT) && !defined(ARDUINO_SEEED_XIAO_M0)
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
#endif
// Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13/PA17.
// Attention!!! D2 and D4 are swapped on these boards!!!
// If you connect the LED, it is on pin 24/PB11. In this case activate the next two lines.
//#undef LED_BUILTIN
//#define LED_BUILTIN 24 // PB11
// As an alternative you can choose pin 25, it is the RX-LED pin (PB03), but active low.In this case activate the next 3 lines.
//#undef LED_BUILTIN
//#define LED_BUILTIN 25 // PB03
//#define FEEDBACK_LED_IS_ACTIVE_LOW // The RX LED on the M0-Mini is active LOW
#elif defined (NRF51) // BBC micro:bit
#define IR_RECEIVE_PIN 2
#define IR_SEND_PIN 3
#define APPLICATION_PIN 1
#define _IR_TIMING_TEST_PIN 4
#define tone(...) void() // no tone() available
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#else
#warning Board / CPU is not detected using pre-processor symbols -> using default values, which may not fit. Please extend PinDefinitionsAndMore.h.
// Default valued for unidentified boards
#define IR_RECEIVE_PIN 2
#define IR_SEND_PIN 3
#define TONE_PIN 4
#define APPLICATION_PIN 5
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
#define _IR_TIMING_TEST_PIN 7
#endif // defined(ESP8266)
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE) || defined(ARDUINO_ARCH_MBED)
#define SEND_PWM_BY_TIMER // We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
#else
# if defined(SEND_PWM_BY_TIMER)
#undef IR_SEND_PIN // SendPin is determined by timer! This avoids warnings in IRremote.hpp and IRTimer.hpp
# endif
#endif
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
/*
* Helper macro for getting a macro definition as string
*/
#if !defined(STR_HELPER)
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#endif

View File

@ -1,147 +0,0 @@
/*
* ReceiveAndSendHob2Hood.cpp
*
* Demonstrates receiving and sending of IR codes for AEG / Elektrolux Hob2Hood protocol
*
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
*
************************************************************************************
* MIT License
*
* Copyright (c) 2024 Armin Joachimsmeyer
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
************************************************************************************
*/
#include <Arduino.h>
#define DECODE_HASH // Only decoder, which works for Hob2Hood. protocol is UNKNOWN and only raw data is set.
//#define NO_LED_FEEDBACK_CODE // saves 92 bytes program memory
//#define SEND_PWM_BY_TIMER // Disable carrier PWM generation in software and use (restricted) hardware PWM.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
// IR commands from AEG hob2hood device
#define NUMBER_OF_HOB_TO_HOOD_COMMANDS 7
#define HOB_TO_HOOD_HASH_CODE_FAN_1 0xE3C01BE2
#define HOB_TO_HOOD_HASH_CODE_FAN_2 0xD051C301
#define HOB_TO_HOOD_HASH_CODE_FAN_3 0xC22FFFD7
#define HOB_TO_HOOD_HASH_CODE_FAN_4 0xB9121B29
#define HOB_TO_HOOD_HASH_CODE_FAN_OFF 0x55303A3
#define HOB_TO_HOOD_HASH_CODE_LIGHT_ON 0xE208293C
#define HOB_TO_HOOD_HASH_CODE_LIGHT_OFF 0x24ACF947
// based on https://pastebin.com/N6kG7Wu5
#define HOB_TO_HOOD_UNIT_MICROS 725
#define H2H_1 HOB_TO_HOOD_UNIT_MICROS
#define H2H_2 (HOB_TO_HOOD_UNIT_MICROS*2) // 1450
#define H2H_3 (HOB_TO_HOOD_UNIT_MICROS*3) // 2175
#define H2H_4 (HOB_TO_HOOD_UNIT_MICROS*4) // 2900
#define H2H_5 (HOB_TO_HOOD_UNIT_MICROS*5) // 3625
// First entry is the length of the raw command
const uint16_t Fan1[] PROGMEM { 15, H2H_2, H2H_2, H2H_1, H2H_2, H2H_3, H2H_2, H2H_1, H2H_2, H2H_1, H2H_1, H2H_1, H2H_2, H2H_1,
H2H_3, H2H_1 };
const uint16_t Fan2[] PROGMEM { 9, H2H_2, H2H_2, H2H_1, H2H_4, H2H_1, H2H_3, H2H_5, H2H_3, H2H_3 };
const uint16_t Fan3[] PROGMEM { 9, H2H_1, H2H_3, H2H_4, H2H_4, H2H_3, H2H_1, H2H_1, H2H_3, H2H_3 };
const uint16_t Fan4[] PROGMEM { 13, H2H_2, H2H_3, H2H_2, H2H_1, H2H_2, H2H_3, H2H_2, H2H_2, H2H_1, H2H_3, H2H_1, H2H_1, H2H_2 };
const uint16_t FanOff[] PROGMEM { 15, H2H_1, H2H_2, H2H_1, H2H_2, H2H_3, H2H_2, H2H_1, H2H_2, H2H_2, H2H_3, H2H_1, H2H_2, H2H_1,
H2H_1, H2H_1 };
const uint16_t LightOn[] PROGMEM { 17, H2H_1, H2H_2, H2H_1, H2H_1, H2H_2, H2H_1, H2H_1, H2H_2, H2H_1, H2H_1, H2H_2, H2H_4, H2H_1,
H2H_1, H2H_1, H2H_1, H2H_2 };
const uint16_t LightOff[] PROGMEM { 17, H2H_1, H2H_2, H2H_1, H2H_1, H2H_1, H2H_1, H2H_1, H2H_3, H2H_1, H2H_1, H2H_1, H2H_2, H2H_1,
H2H_2, H2H_1, H2H_1, H2H_1 };
const uint16_t *const Hob2HoodSendCommands[NUMBER_OF_HOB_TO_HOOD_COMMANDS] = { Fan1, Fan2, Fan3, Fan4, FanOff, LightOn, LightOff }; // Constant array in RAM
void setup() {
Serial.begin(115200);
while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores.
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || 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 Hob2Hood IR signals at pin " STR(IR_RECEIVE_PIN)));
IrSender.begin(); // Start with IR_SEND_PIN -which is defined in PinDefinitionsAndMore.h- as send pin and enable feedback LED at default feedback LED pin
Serial.println(F("Send Hob2Hood IR signals at pin " STR(IR_SEND_PIN)));
}
/*
* Receive and send Hob2Hood protocol
*/
void loop() {
static long sLastMillisOfSend = 0;
static uint8_t sSendCommandIndex = 0;
if (IrReceiver.decode()) {
IrReceiver.resume(); // Early enable receiving of the next IR frame
IrReceiver.printIRResultShort(&Serial);
/*
* Finally, check the received data and perform actions according to the received command
*/
switch (IrReceiver.decodedIRData.decodedRawData) {
case HOB_TO_HOOD_HASH_CODE_FAN_OFF:
Serial.print(F("FAN off"));
break;
case HOB_TO_HOOD_HASH_CODE_FAN_1:
Serial.print(F("FAN 1"));
break;
case HOB_TO_HOOD_HASH_CODE_FAN_2:
Serial.print(F("FAN 2"));
break;
default:
Serial.print(F("unknown Hob2Hood IR command"));
break;
}
}
/*
* Send next command every 5 seconds
*/
if (millis() - sLastMillisOfSend > 2000) {
sLastMillisOfSend = millis();
#if defined(__AVR__)
uint16_t tLengthOfRawCommand = pgm_read_word(Hob2HoodSendCommands[sSendCommandIndex]); // length is the 1. word in array
#else
uint16_t tLengthOfRawCommand = *Hob2HoodSendCommands[sSendCommandIndex]; // length is the 1. word in array
#endif
const uint16_t *tAddressOfRawCommandSequence = Hob2HoodSendCommands[sSendCommandIndex] + 1; // Raw sequence starts at the 2. word of array
Serial.print(F("Send Hob2Hood command index="));
Serial.println(sSendCommandIndex);
IrSender.sendRaw_P(tAddressOfRawCommandSequence, tLengthOfRawCommand, 38);
// Prepare for next command
sSendCommandIndex++;
if (sSendCommandIndex >= NUMBER_OF_HOB_TO_HOOD_COMMANDS) {
sSendCommandIndex = 0;
}
}
}

View File

@ -94,7 +94,18 @@
#define DECODE_SAMSUNG #define DECODE_SAMSUNG
#define ADDRESS_OF_SAMSUNG_REMOTE 0x07 // The value you see as address in printIRResultShort() #define ADDRESS_OF_SAMSUNG_REMOTE 0x07 // The value you see as address in printIRResultShort()
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc. #define TONE_PIN 8
#define IR_RECEIVE_PIN 4
#define IR_SEND_PIN 3
/*
* Helper macro for getting a macro definition as string
*/
#if !defined(STR_HELPER)
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#endif
#include <IRremote.hpp> #include <IRremote.hpp>
void sendSamsungSmartHubMacro(bool aDoSelect); void sendSamsungSmartHubMacro(bool aDoSelect);
@ -103,14 +114,10 @@ void IRSendWithDelay(uint8_t aCommand, uint16_t aDelayMillis);
void setup() { void setup() {
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200); Serial.begin(9600);
while (!Serial) while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores. ; // Wait for Serial to become available. Is optimized away for some cores.
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || 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 // Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE)); Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
@ -193,9 +200,7 @@ void sendSamsungSmartHubMacro(bool aDoSelect) {
tWaitTimeAfterBoot = INITIAL_WAIT_TIME_SMARTHUB_READY_MILLIS; tWaitTimeAfterBoot = INITIAL_WAIT_TIME_SMARTHUB_READY_MILLIS;
} }
#if !defined(ESP32) // ESP32 uses another timer for tone(), so the receiver must not be stopped and restarted for it
IrReceiver.stopTimer(); IrReceiver.stopTimer();
#endif
if (millis() < tWaitTimeAfterBoot) { if (millis() < tWaitTimeAfterBoot) {
// division by 1000 and printing requires much (8%) program memory // division by 1000 and printing requires much (8%) program memory
Serial.print(F("It is ")); Serial.print(F("It is "));
@ -221,9 +226,7 @@ void sendSamsungSmartHubMacro(bool aDoSelect) {
tone(TONE_PIN, 2200, 200); tone(TONE_PIN, 2200, 200);
delay(200); delay(200);
#if !defined(ESP32)
IrReceiver.restartTimer(); // Restart IR timer. IrReceiver.restartTimer(); // Restart IR timer.
#endif
Serial.println(F("Wait for \"not supported\" to disappear")); Serial.println(F("Wait for \"not supported\" to disappear"));
delay(2000); delay(2000);

View File

@ -45,21 +45,27 @@
//#define DEBUG // Activate this for lots of lovely debug output from the decoders. //#define DEBUG // Activate this for lots of lovely debug output from the decoders.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc. #define IR_RECEIVE_PIN 4
#define IR_SEND_PIN 3
/*
* Helper macro for getting a macro definition as string
*/
#if !defined(STR_HELPER)
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#endif
#include <IRremote.hpp> #include <IRremote.hpp>
#define DELAY_AFTER_SEND 2000 #define DELAY_AFTER_SEND 2000
#define DELAY_AFTER_LOOP 5000 #define DELAY_AFTER_LOOP 5000
void setup() { void setup() {
Serial.begin(115200); Serial.begin(9600);
while (!Serial) while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores. ; // Wait for Serial to become available. Is optimized away for some cores.
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || 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 // Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE)); Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
@ -72,9 +78,7 @@ void setup() {
IrSender.begin(); // Start with IR_SEND_PIN -which is defined in PinDefinitionsAndMore.h- as send pin and enable feedback LED at default feedback LED pin IrSender.begin(); // Start with IR_SEND_PIN -which is defined in PinDefinitionsAndMore.h- as send pin and enable feedback LED at default feedback LED pin
Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN))); Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN)));
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604 # if !defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM)
// For esp32 we use PWM generation by ledcWrite() for each pin.
# if !defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM) && !defined(ESP32)
/* /*
* Print internal software PWM generation info * Print internal software PWM generation info
*/ */
@ -93,7 +97,6 @@ void setup() {
Serial.println(F(" us is the (minimum) gap, after which the start of a new IR packet is assumed")); Serial.println(F(" us is the (minimum) gap, after which the start of a new IR packet is assumed"));
Serial.print(MARK_EXCESS_MICROS); Serial.print(MARK_EXCESS_MICROS);
Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding")); Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding"));
#endif
} }
uint16_t sAddress = 0x0102; uint16_t sAddress = 0x0102;
@ -123,11 +126,7 @@ void receive_ir_data() {
Serial.print(F("Decoded protocol: ")); Serial.print(F("Decoded protocol: "));
Serial.print(getProtocolString(IrReceiver.decodedIRData.protocol)); Serial.print(getProtocolString(IrReceiver.decodedIRData.protocol));
Serial.print(F(", decoded raw data: ")); Serial.print(F(", decoded raw data: "));
#if (__INT_WIDTH__ < 32)
Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX); Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX);
#else
PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawData, HEX);
#endif
Serial.print(F(", decoded address: ")); Serial.print(F(", decoded address: "));
Serial.print(IrReceiver.decodedIRData.address, HEX); Serial.print(IrReceiver.decodedIRData.address, HEX);
Serial.print(F(", decoded command: ")); Serial.print(F(", decoded command: "));
@ -161,5 +160,5 @@ void loop() {
sCommand += 0x11; sCommand += 0x11;
sRepeats++; sRepeats++;
delay(100); // Loop delay delay(500); // Loop delay
} }

View File

@ -33,11 +33,16 @@
*/ */
#include <Arduino.h> #include <Arduino.h>
#if !defined(ARDUINO_ESP32C3_DEV) // This is due to a bug in RISC-V compiler, which requires unused function sections :-(. /*
#define DISABLE_CODE_FOR_RECEIVER // Disables static receiver code like receive timer ISR handler and static IRReceiver and irparams data. Saves 450 bytes program memory and 269 bytes RAM if receiving functions are not required. * Helper macro for getting a macro definition as string
*/
#if !defined(STR_HELPER)
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#endif #endif
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc. #define IR_SEND_PIN 3
#include <IRremote.hpp> #include <IRremote.hpp>
//...................................................................... //......................................................................
@ -109,19 +114,15 @@ void printMenu();
void setup() { void setup() {
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200); Serial.begin(9600);
while (!Serial) while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores. ; // Wait for Serial to become available. Is optimized away for some cores.
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || 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 // Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE)); Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
#if defined(IR_SEND_PIN) #if defined(IR_SEND_PIN)
IrSender.begin(); // Start with IR_SEND_PIN -which is defined in PinDefinitionsAndMore.h- as send pin and enable feedback LED at default feedback LED pin IrSender.begin(); // Start with IR_SEND_PIN as send pin and enable feedback LED at default feedback LED pin
Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN))); Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN)));
#else #else
uint8_t tSendPin = 3; uint8_t tSendPin = 3;

View File

@ -42,19 +42,21 @@
//#define USE_LG2_PROTOCOL // Try it if you do not have success with the default LG protocol //#define USE_LG2_PROTOCOL // Try it if you do not have success with the default LG protocol
#define NUMBER_OF_COMMANDS_BETWEEN_PRINT_OF_MENU 5 #define NUMBER_OF_COMMANDS_BETWEEN_PRINT_OF_MENU 5
#if !defined(ARDUINO_ESP32C3_DEV) // This is due to a bug in RISC-V compiler, which requires unused function sections :-(.
#define DISABLE_CODE_FOR_RECEIVER // Disables static receiver code like receive timer ISR handler and static IRReceiver and irparams data. Saves 450 bytes program memory and 269 bytes RAM if receiving functions are not required.
#endif
#define INFO // Deactivate this to save program memory and suppress info output from the LG-AC driver. #define INFO // Deactivate this to save program memory and suppress info output from the LG-AC driver.
//#define DEBUG // Activate this for more output from the LG-AC driver. //#define DEBUG // Activate this for more output from the LG-AC driver.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc. /*
* Helper macro for getting a macro definition as string
*/
#if !defined(STR_HELPER)
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#endif
#define IR_SEND_PIN 3
#include <IRremote.hpp> #include <IRremote.hpp>
#if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
#include "ATtinySerialOut.hpp" // Available as Arduino library "ATtinySerialOut"
#endif
#include "ac_LG.hpp" #include "ac_LG.hpp"
@ -66,14 +68,11 @@ Aircondition_LG MyLG_Aircondition;
void setup() { void setup() {
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200); Serial.begin(9600);
while (!Serial) while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores. ; // Wait for Serial to become available. Is optimized away for some cores.
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || 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 // Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE)); Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN))); Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN)));
@ -81,7 +80,7 @@ delay(4000); // To be able to connect Serial monitor after reset or power up and
/* /*
* The IR library setup. That's all! * The IR library setup. That's all!
*/ */
IrSender.begin(); // Start with IR_SEND_PIN -which is defined in PinDefinitionsAndMore.h- as send pin and enable feedback LED at default feedback LED pin IrSender.begin(); // Start with IR_SEND_PIN as send pin and enable feedback LED at default feedback LED pin
Serial.println(); Serial.println();
MyLG_Aircondition.setType(LG_IS_WALL_TYPE); MyLG_Aircondition.setType(LG_IS_WALL_TYPE);

View File

@ -32,11 +32,16 @@
*/ */
#include <Arduino.h> #include <Arduino.h>
#if !defined(ARDUINO_ESP32C3_DEV) // This is due to a bug in RISC-V compiler, which requires unused function sections :-(. #define IR_SEND_PIN 3
#define DISABLE_CODE_FOR_RECEIVER // Disables static receiver code like receive timer ISR handler and static IRReceiver and irparams data. Saves 450 bytes program memory and 269 bytes RAM if receiving functions are not required.
/*
* Helper macro for getting a macro definition as string
*/
#if !defined(STR_HELPER)
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#endif #endif
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp> #include <IRremote.hpp>
#define NUMBER_OF_REPEATS 3U #define NUMBER_OF_REPEATS 3U
@ -45,9 +50,6 @@
// The second number, here 006C, denotes a frequency code. 006C corresponds to 1000000/(0x006c * 0.241246) = 38381 Hertz. // The second number, here 006C, denotes a frequency code. 006C corresponds to 1000000/(0x006c * 0.241246) = 38381 Hertz.
// The third and the forth number denote the number of pairs (= half the number of durations) in the start- and the repeat sequence respectively. // The third and the forth number denote the number of pairs (= half the number of durations) in the start- and the repeat sequence respectively.
const char yamahaVolDown[] const char yamahaVolDown[]
#if defined(__AVR__)
PROGMEM
#endif
= "0000 006C 0022 0002 015B 00AD " /* Pronto header + start bit */ = "0000 006C 0022 0002 015B 00AD " /* Pronto header + start bit */
"0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 " /* Lower address byte */ "0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 " /* Lower address byte */
"0016 0041 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 " /* Upper address byte (inverted at 8 bit mode) */ "0016 0041 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 " /* Upper address byte (inverted at 8 bit mode) */
@ -58,7 +60,7 @@ PROGMEM
IRsend irsend; IRsend irsend;
void setup() { void setup() {
Serial.begin(115200); Serial.begin(9600);
while (!Serial) while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores. ; // Wait for Serial to become available. Is optimized away for some cores.
@ -66,21 +68,15 @@ void setup() {
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE)); Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN))); Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN)));
IrSender.begin(); // Start with IR_SEND_PIN -which is defined in PinDefinitionsAndMore.h- as send pin and enable feedback LED at default feedback LED pin IrSender.begin(); // Start with IR_SEND_PIN as send pin and enable feedback LED at default feedback LED pin
} }
void loop() { void loop() {
#if defined(__AVR__)
Serial.println(F("Sending NEC from PROGMEM: address 0x85, data 0x1B"));
irsend.sendPronto_P(yamahaVolDown, NUMBER_OF_REPEATS);
#else
Serial.println(F("Sending from normal memory")); Serial.println(F("Sending from normal memory"));
irsend.sendPronto(yamahaVolDown, NUMBER_OF_REPEATS); irsend.sendPronto(yamahaVolDown, NUMBER_OF_REPEATS);
#endif
delay(2000); delay(2000);
Serial.println(F("Sending the NEC from PROGMEM using the F()-form: address 0x5, data 0x1A")); Serial.println(F("Sending the NEC using the F()-form: address 0x5, data 0x1A"));
irsend.sendPronto(F("0000 006C 0022 0002 015B 00AD " /* Pronto header + start bit */ irsend.sendPronto(F("0000 006C 0022 0002 015B 00AD " /* Pronto header + start bit */
"0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 " /* Lower address byte */ "0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 " /* Lower address byte */
"0016 0041 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 " /* Upper address byte (inverted at 8 bit mode) */ "0016 0041 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 " /* Upper address byte (inverted at 8 bit mode) */

View File

@ -36,34 +36,34 @@
*/ */
#include <Arduino.h> #include <Arduino.h>
#if !defined(ARDUINO_ESP32C3_DEV) // This is due to a bug in RISC-V compiler, which requires unused function sections :-(.
#define DISABLE_CODE_FOR_RECEIVER // Disables static receiver code like receive timer ISR handler and static IRReceiver and irparams data. Saves 450 bytes program memory and 269 bytes RAM if receiving functions are not required.
#endif
//#define SEND_PWM_BY_TIMER // Disable carrier PWM generation in software and use (restricted) hardware PWM. //#define SEND_PWM_BY_TIMER // Disable carrier PWM generation in software and use (restricted) hardware PWM.
//#define USE_NO_SEND_PWM // Use no carrier PWM, just simulate an active low receiver signal. Overrides SEND_PWM_BY_TIMER definition //#define USE_NO_SEND_PWM // Use no carrier PWM, just simulate an active low receiver signal. Overrides SEND_PWM_BY_TIMER definition
//#define NO_LED_FEEDBACK_CODE // Saves 566 bytes program memory //#define NO_LED_FEEDBACK_CODE // Saves 566 bytes program memory
//#define USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN // Use or simulate open drain output mode at send pin. Attention, active state of open drain is LOW, so connect the send LED between positive supply and send pin!
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc. #define IR_SEND_PIN 3
/*
* Helper macro for getting a macro definition as string
*/
#if !defined(STR_HELPER)
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#endif
#include <IRremote.hpp> #include <IRremote.hpp>
void setup() { void setup() {
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200); Serial.begin(9600);
while (!Serial) while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores. ; // Wait for Serial to become available. Is optimized away for some cores.
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || 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 // Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE)); Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN))); Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN)));
IrSender.begin(); // Start with IR_SEND_PIN -which is defined in PinDefinitionsAndMore.h- as send pin and enable feedback LED at default feedback LED pin IrSender.begin(); // Start with IR_SEND_PIN as send pin and enable feedback LED at default feedback LED pin
} }
/* /*
@ -77,8 +77,8 @@ void setup() {
* e.g. use 560 (instead of 11 * 50) for NEC or use 432 for Panasonic. But in this cases, * e.g. use 560 (instead of 11 * 50) for NEC or use 432 for Panasonic. But in this cases,
* you better use the timing generation functions e.g. sendNEC() directly. * you better use the timing generation functions e.g. sendNEC() directly.
*/ */
const uint8_t rawDataP[] PROGMEM const uint8_t rawDataP[] =
= { 180, 90 /*Start bit*/, 11, 11, 11, 11, 11, 34, 11, 11/*0010 0x4 of 8 bit address LSB first*/, 11, 11, 11, 11, 11, 11, 11, { 180, 90 /*Start bit*/, 11, 11, 11, 11, 11, 34, 11, 11/*0010 0x4 of 8 bit address LSB first*/, 11, 11, 11, 11, 11, 11, 11,
11/*0000*/, 11, 34, 11, 34, 11, 11, 11, 34/*1101 0xB*/, 11, 34, 11, 34, 11, 34, 11, 34/*1111*/, 11, 11, 11, 11, 11, 11, 11, 11/*0000*/, 11, 34, 11, 34, 11, 11, 11, 34/*1101 0xB*/, 11, 34, 11, 34, 11, 34, 11, 34/*1111*/, 11, 11, 11, 11, 11, 11, 11,
34/*0001 0x08 of command LSB first*/, 11, 34, 11, 11, 11, 11, 11, 11/*1000 0x01*/, 11, 34, 11, 34, 11, 34, 11, 34/*0001 0x08 of command LSB first*/, 11, 34, 11, 11, 11, 11, 11, 11/*1000 0x01*/, 11, 34, 11, 34, 11, 34, 11,
11/*1110 Inverted 8 of command*/, 11, 11, 11, 34, 11, 34, 11, 34/*0111 inverted 1 of command*/, 11 /*stop bit*/}; 11/*1110 Inverted 8 of command*/, 11, 11, 11, 34, 11, 34, 11, 34/*0111 inverted 1 of command*/, 11 /*stop bit*/};
@ -94,8 +94,6 @@ const uint16_t rawData[] = { 9000, 4500/*Start bit*/, 560, 560, 560, 560, 560, 1
1690/*1111 inverted 0 of command*/, 560 /*stop bit*/}; // Using exact NEC timing 1690/*1111 inverted 0 of command*/, 560 /*stop bit*/}; // Using exact NEC timing
void loop() { void loop() {
#if FLASHEND > 0x1FFF // For more than 8k flash => not for ATtiny85 etc.
/* /*
* Send hand crafted data from RAM * Send hand crafted data from RAM
*/ */
@ -105,8 +103,6 @@ void loop() {
delay(1000); // delay must be greater than 8 ms (RECORD_GAP_MICROS), otherwise the receiver sees it as one long signal delay(1000); // delay must be greater than 8 ms (RECORD_GAP_MICROS), otherwise the receiver sees it as one long signal
#endif
/* /*
* Send byte data direct from FLASH * Send byte data direct from FLASH
* Note the approach used to automatically calculate the size of the array. * Note the approach used to automatically calculate the size of the array.

View File

@ -13,22 +13,17 @@
*/ */
#include <Arduino.h> #include <Arduino.h>
#if !defined(ARDUINO_ESP32C3_DEV) // This is due to a bug in RISC-V compiler, which requires unused function sections :-(.
#define DISABLE_CODE_FOR_RECEIVER // Disables static receiver code like receive timer ISR handler and static IRReceiver and irparams data. Saves 450 bytes program memory and 269 bytes RAM if receiving functions are not required.
#endif
//#define SEND_PWM_BY_TIMER // Disable carrier PWM generation in software and use (restricted) hardware PWM. //#define SEND_PWM_BY_TIMER // Disable carrier PWM generation in software and use (restricted) hardware PWM.
//#define USE_NO_SEND_PWM // Use no carrier PWM, just simulate an active low receiver signal. Overrides SEND_PWM_BY_TIMER definition #define USE_NO_SEND_PWM // Use no carrier PWM, just simulate an active low receiver signal. Overrides SEND_PWM_BY_TIMER definition
#define IR_SEND_PIN 5
/*
* This include defines the actual pin number for pins like IR_RECEIVE_PIN, IR_SEND_PIN for many different boards and architectures
*/
#include "PinDefinitionsAndMore.h"
#include <IRremote.hpp> // include the library #include <IRremote.hpp> // include the library
void setup() { void setup() {
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200); Serial.begin(9600);
while (!Serial) while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores. ; // Wait for Serial to become available. Is optimized away for some cores.

View File

@ -46,14 +46,15 @@
*/ */
#include <Arduino.h> #include <Arduino.h>
#include "PinDefinitionsAndMore.h" // Set IR_SEND_PIN for different CPU's #define IR_SEND_PIN 3
#include "TinyIRSender.hpp" #include "TinyIRSender.hpp"
void setup() { void setup() {
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200); Serial.begin(9600);
while (!Serial) while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores. ; // Wait for Serial to become available. Is optimized away for some cores.

View File

@ -33,24 +33,17 @@
#include <Arduino.h> #include <Arduino.h>
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc. #define IR_SEND_PIN 3
#if !defined(RAW_BUFFER_LENGTH) #if !defined(RAW_BUFFER_LENGTH)
// For air condition remotes it requires 600 (maximum for 2k RAM) to 750. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
# if (defined(RAMEND) && RAMEND <= 0x4FF) || (defined(RAMSIZE) && RAMSIZE < 0x4FF)
#define RAW_BUFFER_LENGTH 360
# elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
#define RAW_BUFFER_LENGTH 400 // 400 is OK with Pronto and 1000 is OK without Pronto. 1200 is too much here, because then variables are overwritten. #define RAW_BUFFER_LENGTH 400 // 400 is OK with Pronto and 1000 is OK without Pronto. 1200 is too much here, because then variables are overwritten.
#endif #endif
#endif
//#define EXCLUDE_UNIVERSAL_PROTOCOLS // Saves up to 1000 bytes program memory. //#define EXCLUDE_UNIVERSAL_PROTOCOLS // Saves up to 1000 bytes program memory.
//#define EXCLUDE_EXOTIC_PROTOCOLS // Saves around 240 bytes program memory if IrSender.write is used //#define EXCLUDE_EXOTIC_PROTOCOLS // Saves around 240 bytes program memory if IrSender.write is used
//#define SEND_PWM_BY_TIMER // Disable carrier PWM generation in software and use (restricted) hardware PWM. //#define SEND_PWM_BY_TIMER // Disable carrier PWM generation in software and use (restricted) hardware PWM.
//#define USE_NO_SEND_PWM // Use no carrier PWM, just simulate an active low receiver signal. Overrides SEND_PWM_BY_TIMER definition //#define USE_NO_SEND_PWM // Use no carrier PWM, just simulate an active low receiver signal. Overrides SEND_PWM_BY_TIMER definition
#if FLASHEND <= 0x7FFF // For 32k flash or less, like ATmega328
#define NO_LED_FEEDBACK_CODE // Saves 344 bytes program memory
#endif
// MARK_EXCESS_MICROS is subtracted from all marks and added to all spaces before decoding, // MARK_EXCESS_MICROS is subtracted from all marks and added to all spaces before decoding,
//#define USE_MSB_DECODING_FOR_DISTANCE_DECODER //#define USE_MSB_DECODING_FOR_DISTANCE_DECODER
// to compensate for the signal forming of different IR receiver modules. See also IRremote.hpp line 142. // to compensate for the signal forming of different IR receiver modules. See also IRremote.hpp line 142.
@ -61,33 +54,26 @@
//#define TRACE // For internal usage //#define TRACE // For internal usage
//#define DEBUG // Activate this for lots of lovely debug output from the decoders. //#define DEBUG // Activate this for lots of lovely debug output from the decoders.
#if FLASHEND >= 0x1FFF // For 8k flash or more, like ATtiny85
#define DECODE_DENON // Includes Sharp #define DECODE_DENON // Includes Sharp
#define DECODE_KASEIKYO #define DECODE_KASEIKYO
#define DECODE_PANASONIC // alias for DECODE_KASEIKYO #define DECODE_PANASONIC // alias for DECODE_KASEIKYO
#define DECODE_NEC // Includes Apple and Onkyo #define DECODE_NEC // Includes Apple and Onkyo
#endif
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
#define DECODE_JVC #define DECODE_JVC
#define DECODE_RC5 #define DECODE_RC5
#define DECODE_RC6 #define DECODE_RC6
#define DECODE_DISTANCE_WIDTH // Universal decoder for pulse distance width protocols #define DECODE_DISTANCE_WIDTH // Universal decoder for pulse distance width protocols
#define DECODE_HASH // special decoder for all protocols #define DECODE_HASH // special decoder for all protocols
#endif
#if FLASHEND >= 0x7FFF // For 32k flash or more, like ATmega328
#define DECODE_SONY #define DECODE_SONY
#define DECODE_SAMSUNG #define DECODE_SAMSUNG
#define DECODE_LG #define DECODE_LG
#define DECODE_BEO // It prevents decoding of SONY (default repeats), which we are not using here. #define DECODE_BEO // It prevents decoding of SONY (default repeats), which we are not using here.
//#define ENABLE_BEO_WITHOUT_FRAME_GAP // !!!For successful unit testing we must see the warning at ir_BangOlufsen.hpp:100:2!!! //#define ENABLE_BEO_WITHOUT_FRAME_GAP // !!!For successful unit testing we must see the warning at ir_BangOlufsen.hpp:100:2!!!
#if defined(DECODE_BEO)
#define RECORD_GAP_MICROS 16000 // Force to get the complete frame including the 3. space of 15 ms in the receive buffer #define RECORD_GAP_MICROS 16000 // Force to get the complete frame including the 3. space of 15 ms in the receive buffer
#define BEO_KHZ 38 // We send and receive Bang&Olufsen with 38 kHz here (instead of 455 kHz). #define BEO_KHZ 38 // We send and receive Bang&Olufsen with 38 kHz here (instead of 455 kHz).
#endif
#define DECODE_BOSEWAVE #define DECODE_BOSEWAVE
#define DECODE_MAGIQUEST #define DECODE_MAGIQUEST
@ -95,17 +81,22 @@
//#define DECODE_WHYNTER //#define DECODE_WHYNTER
//#define DECODE_LEGO_PF //#define DECODE_LEGO_PF
/*
* Helper macro for getting a macro definition as string
*/
#if !defined(STR_HELPER)
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#endif #endif
//#undef IR_SEND_PIN // enable this, if you need to set send pin programmatically using uint8_t tSendPin below #define IR_SEND_PIN 3
#define IR_RECEIVE_PIN 4
#define BTN_ACTIVE_STATE HIGH
#include <IRremote.hpp> #include <IRremote.hpp>
#if defined(APPLICATION_PIN)
#define DEBUG_BUTTON_PIN APPLICATION_PIN // if held low, print timing for each received data
#else
#define DEBUG_BUTTON_PIN 6
#endif
#define DELAY_AFTER_SEND 1000 #define DELAY_AFTER_SEND 1000
#define DELAY_AFTER_LOOP 5000 #define DELAY_AFTER_LOOP 5000
@ -120,16 +111,12 @@ volatile bool sDataJustReceived = false;
void ReceiveCompleteCallbackHandler(); void ReceiveCompleteCallbackHandler();
void setup() { void setup() {
pinMode(DEBUG_BUTTON_PIN, INPUT_PULLUP); pinMode(BTN_BUILTIN, INPUT_PULLUP);
Serial.begin(115200); Serial.begin(9600);
while (!Serial) while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores. ; // Wait for Serial to become available. Is optimized away for some cores.
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || 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 // Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE)); Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
@ -139,18 +126,13 @@ void setup() {
Serial.print(F("Ready to receive IR signals of protocols: ")); Serial.print(F("Ready to receive IR signals of protocols: "));
printActiveIRProtocols(&Serial); printActiveIRProtocols(&Serial);
#if defined(IR_RECEIVE_PIN_STRING)
Serial.println(F("at pin " IR_RECEIVE_PIN_STRING));
#else
Serial.println(F("at pin " STR(IR_RECEIVE_PIN))); Serial.println(F("at pin " STR(IR_RECEIVE_PIN)));
#endif
#if defined(LED_BUILTIN) && !defined(NO_LED_FEEDBACK_CODE) #if defined(LED_BUILTIN) && !defined(NO_LED_FEEDBACK_CODE)
# if defined(FEEDBACK_LED_IS_ACTIVE_LOW)
Serial.print(F("Active low "));
# endif
Serial.print(F("FeedbackLED at pin ")); Serial.print(F("FeedbackLED at pin "));
Serial.println(LED_BUILTIN); // Works also for ESP32: static const uint8_t LED_BUILTIN = 8; #define LED_BUILTIN LED_BUILTIN Serial.println(LED_BUILTIN);
#endif #endif
Serial.println(F("Use ReceiveCompleteCallback")); Serial.println(F("Use ReceiveCompleteCallback"));
@ -158,11 +140,7 @@ void setup() {
#if defined(IR_SEND_PIN) #if defined(IR_SEND_PIN)
IrSender.begin(); // Start with IR_SEND_PIN -which is defined in PinDefinitionsAndMore.h- as send pin and enable feedback LED at default feedback LED pin IrSender.begin(); // Start with IR_SEND_PIN -which is defined in PinDefinitionsAndMore.h- as send pin and enable feedback LED at default feedback LED pin
# if defined(IR_SEND_PIN_STRING)
Serial.println(F("Send IR signals at pin " IR_SEND_PIN_STRING));
# else
Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN))); Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN)));
# endif
#else #else
// Here the macro IR_SEND_PIN is not defined or undefined above with #undef IR_SEND_PIN // Here the macro IR_SEND_PIN is not defined or undefined above with #undef IR_SEND_PIN
uint8_t tSendPin = 3; uint8_t tSendPin = 3;
@ -173,16 +151,10 @@ void setup() {
Serial.println(tSendPin); Serial.println(tSendPin);
#endif #endif
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604 Serial.print(F("If you press button "));
Serial.print(F("If you connect debug pin ")); Serial.print(BTN_BUILTIN);
# if defined(APPLICATION_PIN_STRING) Serial.println(F(" raw data is always printed"));
Serial.print(APPLICATION_PIN_STRING);
# else
Serial.print(DEBUG_BUTTON_PIN);
# endif
Serial.println(F(" to ground, raw data is always printed"));
// For esp32 we use PWM generation by ledcWrite() for each pin.
# if !defined(SEND_PWM_BY_TIMER) # if !defined(SEND_PWM_BY_TIMER)
/* /*
* Print internal software PWM generation info * Print internal software PWM generation info
@ -202,7 +174,7 @@ void setup() {
Serial.println(F(" us is the (minimum) gap, after which the start of a new IR packet is assumed")); Serial.println(F(" us is the (minimum) gap, after which the start of a new IR packet is assumed"));
Serial.print(MARK_EXCESS_MICROS); Serial.print(MARK_EXCESS_MICROS);
Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding")); Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding"));
#endif
delay(DELAY_AFTER_SEND); delay(DELAY_AFTER_SEND);
} }
@ -215,32 +187,19 @@ void checkReceivedRawData(IRRawDataType aRawData) {
if (IrReceiver.decode()) { if (IrReceiver.decode()) {
// Print a short summary of received data // Print a short summary of received data
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
IrReceiver.printIRResultShort(&Serial); IrReceiver.printIRResultShort(&Serial);
IrReceiver.printIRSendUsage(&Serial); IrReceiver.printIRSendUsage(&Serial);
#else if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(BTN_BUILTIN) == BTN_ACTIVE_STATE) {
IrReceiver.printIRResultMinimal(&Serial);
#endif
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(DEBUG_BUTTON_PIN) == LOW) {
// We have an unknown protocol, print more info // We have an unknown protocol, print more info
IrReceiver.printIRResultRawFormatted(&Serial, true); IrReceiver.printIRResultRawFormatted(&Serial, true);
} }
#endif
if (IrReceiver.decodedIRData.protocol == PULSE_DISTANCE || IrReceiver.decodedIRData.protocol == PULSE_WIDTH) { if (IrReceiver.decodedIRData.protocol == PULSE_DISTANCE || IrReceiver.decodedIRData.protocol == PULSE_WIDTH) {
if (IrReceiver.decodedIRData.decodedRawData != aRawData) { if (IrReceiver.decodedIRData.decodedRawData != aRawData) {
Serial.print(F("ERROR: Received data=0x")); Serial.print(F("ERROR: Received data=0x"));
#if (__INT_WIDTH__ < 32)
Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX); Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX);
#else
PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawData, HEX);
#endif
Serial.print(F(" != sent data=0x")); Serial.print(F(" != sent data=0x"));
#if (__INT_WIDTH__ < 32)
Serial.print(aRawData, HEX); Serial.print(aRawData, HEX);
#else
PrintULL::print(&Serial, aRawData, HEX);
#endif
Serial.println(); Serial.println();
} }
} }
@ -260,28 +219,19 @@ void checkReceivedArray(IRRawDataType *aRawDataArrayPointer, uint8_t aArraySize)
if (IrReceiver.decode()) { if (IrReceiver.decode()) {
// Print a short summary of received data // Print a short summary of received data
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
IrReceiver.printIRResultShort(&Serial); IrReceiver.printIRResultShort(&Serial);
IrReceiver.printIRSendUsage(&Serial); IrReceiver.printIRSendUsage(&Serial);
#else
IrReceiver.printIRResultMinimal(&Serial); if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(BTN_BUILTIN) == BTN_ACTIVE_STATE) {
#endif
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(DEBUG_BUTTON_PIN) == LOW) {
// We have an unknown protocol, print more info // We have an unknown protocol, print more info
IrReceiver.printIRResultRawFormatted(&Serial, true); IrReceiver.printIRResultRawFormatted(&Serial, true);
} }
#endif
if (IrReceiver.decodedIRData.protocol == PULSE_DISTANCE || IrReceiver.decodedIRData.protocol == PULSE_WIDTH) { if (IrReceiver.decodedIRData.protocol == PULSE_DISTANCE || IrReceiver.decodedIRData.protocol == PULSE_WIDTH) {
for (uint_fast8_t i = 0; i < aArraySize; ++i) { for (uint_fast8_t i = 0; i < aArraySize; ++i) {
if (IrReceiver.decodedIRData.decodedRawDataArray[i] != *aRawDataArrayPointer) { if (IrReceiver.decodedIRData.decodedRawDataArray[i] != *aRawDataArrayPointer) {
Serial.print(F("ERROR: Received data=0x")); Serial.print(F("ERROR: Received data=0x"));
# if (__INT_WIDTH__ < 32)
Serial.print(IrReceiver.decodedIRData.decodedRawDataArray[i], HEX); Serial.print(IrReceiver.decodedIRData.decodedRawDataArray[i], HEX);
# else
PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawDataArray[i], HEX);
# endif
Serial.print(F(" != sent data=0x")); Serial.print(F(" != sent data=0x"));
Serial.println(*aRawDataArrayPointer, HEX); Serial.println(*aRawDataArrayPointer, HEX);
} }
@ -319,24 +269,18 @@ void checkReceive(uint16_t aSentAddress, uint16_t aSentCommand) {
if (IrReceiver.decode()) { if (IrReceiver.decode()) {
// Print a short summary of received data // Print a short summary of received data
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
IrReceiver.printIRResultShort(&Serial); IrReceiver.printIRResultShort(&Serial);
IrReceiver.printIRSendUsage(&Serial); IrReceiver.printIRSendUsage(&Serial);
#else
IrReceiver.printIRResultMinimal(&Serial);
#endif
if (IrReceiver.decodedIRData.flags & IRDATA_FLAGS_WAS_OVERFLOW) { if (IrReceiver.decodedIRData.flags & IRDATA_FLAGS_WAS_OVERFLOW) {
Serial.println(F("Try to increase the \"RAW_BUFFER_LENGTH\" value of " STR(RAW_BUFFER_LENGTH) " in " __FILE__)); Serial.println(F("Try to increase the \"RAW_BUFFER_LENGTH\" value of " STR(RAW_BUFFER_LENGTH) " in " __FILE__));
// see also https://github.com/Arduino-IRremote/Arduino-IRremote#compile-options--macros-for-this-library // see also https://github.com/Arduino-IRremote/Arduino-IRremote#compile-options--macros-for-this-library
} }
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604 if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(BTN_BUILTIN) == BTN_ACTIVE_STATE) {
if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(DEBUG_BUTTON_PIN) == LOW) {
// We have an unknown protocol, print more info // We have an unknown protocol, print more info
IrReceiver.printIRResultRawFormatted(&Serial, true); IrReceiver.printIRResultRawFormatted(&Serial, true);
} }
#endif
IrReceiver.resume(); // Early resume IrReceiver.resume(); // Early resume
if (IrReceiver.decodedIRData.protocol == UNKNOWN) { if (IrReceiver.decodedIRData.protocol == UNKNOWN) {
@ -405,7 +349,7 @@ void loop() {
* Complete NEC frames as repeats to force decoding as NEC2 are tested here * Complete NEC frames as repeats to force decoding as NEC2 are tested here
*/ */
for (int8_t i = 0; i < sRepeats; i++) { for (int8_t i = 0; i < sRepeats; i++) {
if (digitalRead(DEBUG_BUTTON_PIN) != LOW) { if (digitalRead(BTN_BUILTIN) != BTN_ACTIVE_STATE) {
// If debug is enabled, printing time (50 ms) is sufficient as delay // If debug is enabled, printing time (50 ms) is sufficient as delay
delayMicroseconds(NEC_REPEAT_DISTANCE - 20000); // 20000 is just a guess delayMicroseconds(NEC_REPEAT_DISTANCE - 20000); // 20000 is just a guess
} }
@ -427,10 +371,7 @@ void loop() {
checkReceive(sAddress, sCommand); checkReceive(sAddress, sCommand);
delay(DELAY_AFTER_SEND); delay(DELAY_AFTER_SEND);
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604. Code does not fit in program memory of ATtiny85 etc.
if (sAddress == 0xFFF1) { if (sAddress == 0xFFF1) {
# if FLASHEND >= 0x7FFF && ((defined(RAMEND) && RAMEND <= 0x6FF) || (defined(RAMSIZE) && RAMSIZE < 0x6FF)) // For 32k flash or more, like Uno. Code does not fit in program memory of ATtiny1604 etc.
/* /*
* Send constant values only once in this demo * Send constant values only once in this demo
*/ */
@ -480,21 +421,12 @@ void loop() {
IrSender.sendNECMSB(0x40802CD3, 32, false); IrSender.sendNECMSB(0x40802CD3, 32, false);
checkReceive(0x0102, 0x34); checkReceive(0x0102, 0x34);
delay(DELAY_AFTER_SEND); delay(DELAY_AFTER_SEND);
# endif
# if __INT_WIDTH__ < 32
IRRawDataType tRawData[4] = { 0xB02002, 0xA010, 0x0, 0x0 }; // LSB of tRawData[0] is sent first
# endif
# if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO) # if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO)
Serial.println(F("Send Panasonic 0xB, 0x10 as 48 bit PulseDistance using ProtocolConstants")); Serial.println(F("Send Panasonic 0xB, 0x10 as 48 bit PulseDistance using ProtocolConstants"));
Serial.flush(); Serial.flush();
# if __INT_WIDTH__ < 32
IrSender.sendPulseDistanceWidthFromArray(&KaseikyoProtocolConstants, &tRawData[0], 48, NO_REPEATS); // Panasonic is a Kaseikyo variant
checkReceive(0x0B, 0x10);
# else
IrSender.sendPulseDistanceWidth(&KaseikyoProtocolConstants, 0xA010B02002, 48, NO_REPEATS); // Panasonic is a Kaseikyo variant IrSender.sendPulseDistanceWidth(&KaseikyoProtocolConstants, 0xA010B02002, 48, NO_REPEATS); // Panasonic is a Kaseikyo variant
checkReceivedRawData(0xA010B02002); checkReceivedRawData(0xA010B02002);
# endif
delay(DELAY_AFTER_SEND); delay(DELAY_AFTER_SEND);
/* /*
@ -503,30 +435,16 @@ void loop() {
Serial.println(F("Send Panasonic 0xB, 0x10 as 48 bit PulseDistance")); Serial.println(F("Send Panasonic 0xB, 0x10 as 48 bit PulseDistance"));
Serial.println(F("-LSB first")); Serial.println(F("-LSB first"));
Serial.flush(); Serial.flush();
# if __INT_WIDTH__ < 32
IrSender.sendPulseDistanceWidthFromArray(38, 3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, PROTOCOL_IS_LSB_FIRST, 0,
NO_REPEATS);
checkReceive(0x0B, 0x10);
# else
IrSender.sendPulseDistanceWidth(38, 3450, 1700, 450, 1250, 450, 400, 0xA010B02002, 48, PROTOCOL_IS_LSB_FIRST, 0, IrSender.sendPulseDistanceWidth(38, 3450, 1700, 450, 1250, 450, 400, 0xA010B02002, 48, PROTOCOL_IS_LSB_FIRST, 0,
NO_REPEATS); NO_REPEATS);
checkReceivedRawData(0xA010B02002); checkReceivedRawData(0xA010B02002);
# endif
delay(DELAY_AFTER_SEND); delay(DELAY_AFTER_SEND);
// The same with MSB first. Use bit reversed raw data of LSB first part // The same with MSB first. Use bit reversed raw data of LSB first part
Serial.println(F("-MSB first")); Serial.println(F("-MSB first"));
# if __INT_WIDTH__ < 32
tRawData[0] = 0x40040D00; // MSB of tRawData[0] is sent first
tRawData[1] = 0x805;
IrSender.sendPulseDistanceWidthFromArray(38, 3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, PROTOCOL_IS_MSB_FIRST, 0,
NO_REPEATS);
checkReceive(0x0B, 0x10);
# else
IrSender.sendPulseDistanceWidth(38, 3450, 1700, 450, 1250, 450, 400, 0x40040D000805, 48, PROTOCOL_IS_MSB_FIRST, 0, IrSender.sendPulseDistanceWidth(38, 3450, 1700, 450, 1250, 450, 400, 0x40040D000805, 48, PROTOCOL_IS_MSB_FIRST, 0,
NO_REPEATS); NO_REPEATS);
checkReceivedRawData(0x40040D000805); checkReceivedRawData(0x40040D000805);
# endif
delay(DELAY_AFTER_SEND); delay(DELAY_AFTER_SEND);
# endif // defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO) # endif // defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO)
@ -535,28 +453,15 @@ void loop() {
# if defined(USE_MSB_DECODING_FOR_DISTANCE_DECODER) # if defined(USE_MSB_DECODING_FOR_DISTANCE_DECODER)
Serial.println(F("Send 52 bit PulseDistance 0x43D8613C and 0x3BC3B MSB first")); Serial.println(F("Send 52 bit PulseDistance 0x43D8613C and 0x3BC3B MSB first"));
Serial.flush(); Serial.flush();
# if __INT_WIDTH__ < 32
tRawData[0] = 0x43D8613C; // MSB of tRawData[0] is sent first
tRawData[1] = 0x3BC3B;
IrSender.sendPulseDistanceWidthFromArray(38, 8900, 4450, 550, 1700, 550, 600, &tRawData[0], 52, PROTOCOL_IS_MSB_FIRST, 0,
NO_REPEATS);
checkReceivedArray(tRawData, 2);
# else
IrSender.sendPulseDistanceWidth(38, 8900, 4450, 550, 1700, 550, 600, 0x43D8613CBC3B, 52, PROTOCOL_IS_MSB_FIRST, 0, NO_REPEATS); IrSender.sendPulseDistanceWidth(38, 8900, 4450, 550, 1700, 550, 600, 0x43D8613CBC3B, 52, PROTOCOL_IS_MSB_FIRST, 0, NO_REPEATS);
checkReceivedRawData(0x43D8613CBC3B); checkReceivedRawData(0x43D8613CBC3B);
# endif
delay(DELAY_AFTER_SEND); delay(DELAY_AFTER_SEND);
Serial.println(F("Send 52 bit PulseDistanceWidth 0x43D8613C and 0x3BC3B MSB first")); Serial.println(F("Send 52 bit PulseDistanceWidth 0x43D8613C and 0x3BC3B MSB first"));
Serial.flush(); Serial.flush();
// Real PulseDistanceWidth (constant bit length) does not require a stop bit // Real PulseDistanceWidth (constant bit length) does not require a stop bit
# if __INT_WIDTH__ < 32
IrSender.sendPulseDistanceWidthFromArray(38, 300, 600, 600, 300, 300, 600, &tRawData[0], 52, PROTOCOL_IS_MSB_FIRST, 0, 0);
checkReceivedArray(tRawData, 2);
# else
IrSender.sendPulseDistanceWidth(38, 300, 600, 600, 300, 300, 600, 0x123456789ABC, 52, PROTOCOL_IS_MSB_FIRST, 0, 0); IrSender.sendPulseDistanceWidth(38, 300, 600, 600, 300, 300, 600, 0x123456789ABC, 52, PROTOCOL_IS_MSB_FIRST, 0, 0);
checkReceivedRawData(0x123456789ABC); checkReceivedRawData(0x123456789ABC);
# endif
delay(DELAY_AFTER_SEND); delay(DELAY_AFTER_SEND);
Serial.println(F("Send 32 bit PulseWidth 0x43D8613C MSB first")); Serial.println(F("Send 32 bit PulseWidth 0x43D8613C MSB first"));
Serial.flush(); Serial.flush();
@ -568,45 +473,23 @@ void loop() {
# else // defined(USE_MSB_DECODING_FOR_DISTANCE_DECODER) # else // defined(USE_MSB_DECODING_FOR_DISTANCE_DECODER)
Serial.println(F("Send 72 bit PulseDistance 0x5A AFEDCBA9 87654321 LSB first")); Serial.println(F("Send 72 bit PulseDistance 0x5A AFEDCBA9 87654321 LSB first"));
Serial.flush(); Serial.flush();
# if __INT_WIDTH__ < 32
tRawData[0] = 0x87654321; // LSB of tRawData[0] is sent first
tRawData[1] = 0xAFEDCBA9;
tRawData[2] = 0x5A;
IrSender.sendPulseDistanceWidthFromArray(38, 8900, 4450, 550, 1700, 550, 600, &tRawData[0], 72, PROTOCOL_IS_LSB_FIRST, 0,
NO_REPEATS);
checkReceivedArray(tRawData, 3);
# else
IRRawDataType tRawData[] = { 0xAFEDCBA987654321, 0x5A }; // LSB of tRawData[0] is sent first IRRawDataType tRawData[] = { 0xAFEDCBA987654321, 0x5A }; // LSB of tRawData[0] is sent first
IrSender.sendPulseDistanceWidthFromArray(38, 8900, 4450, 550, 1700, 550, 600, &tRawData[0], 72, PROTOCOL_IS_LSB_FIRST, 0, IrSender.sendPulseDistanceWidthFromArray(38, 8900, 4450, 550, 1700, 550, 600, &tRawData[0], 72, PROTOCOL_IS_LSB_FIRST, 0,
NO_REPEATS); NO_REPEATS);
checkReceivedArray(tRawData, 2); checkReceivedArray(tRawData, 2);
# endif
delay(DELAY_AFTER_SEND); delay(DELAY_AFTER_SEND);
Serial.println(F("Send 52 bit PulseDistanceWidth 0xDCBA9 87654321 LSB first")); Serial.println(F("Send 52 bit PulseDistanceWidth 0xDCBA9 87654321 LSB first"));
Serial.flush(); Serial.flush();
// Real PulseDistanceWidth (constant bit length) does theoretically not require a stop bit, but we know the stop bit from serial transmission // Real PulseDistanceWidth (constant bit length) does theoretically not require a stop bit, but we know the stop bit from serial transmission
# if __INT_WIDTH__ < 32
tRawData[1] = 0xDCBA9;
IrSender.sendPulseDistanceWidthFromArray(38, 300, 600, 300, 600, 600, 300, &tRawData[0], 52, PROTOCOL_IS_LSB_FIRST, 0, 0);
checkReceivedArray(tRawData, 2);
# else
IrSender.sendPulseDistanceWidth(38, 300, 600, 300, 600, 600, 300, 0xDCBA987654321, 52, PROTOCOL_IS_LSB_FIRST, 0, 0); IrSender.sendPulseDistanceWidth(38, 300, 600, 300, 600, 600, 300, 0xDCBA987654321, 52, PROTOCOL_IS_LSB_FIRST, 0, 0);
checkReceivedRawData(0xDCBA987654321); checkReceivedRawData(0xDCBA987654321);
# endif
delay(DELAY_AFTER_SEND); delay(DELAY_AFTER_SEND);
Serial.println(F("Send 52 bit PulseDistanceWidth 0xDCBA9 87654321 LSB first with inverse timing and data")); Serial.println(F("Send 52 bit PulseDistanceWidth 0xDCBA9 87654321 LSB first with inverse timing and data"));
Serial.flush(); Serial.flush();
# if __INT_WIDTH__ < 32
tRawData[2] = ~tRawData[0];
tRawData[3] = ~tRawData[1];
IrSender.sendPulseDistanceWidthFromArray(38, 300, 600, 600, 300, 300, 600, &tRawData[2], 52, PROTOCOL_IS_LSB_FIRST, 0, 0);
checkReceivedArray(tRawData, 2);
# else
IrSender.sendPulseDistanceWidth(38, 300, 600, 600, 300, 300, 600, ~0xDCBA987654321, 52, PROTOCOL_IS_LSB_FIRST, 0, 0); IrSender.sendPulseDistanceWidth(38, 300, 600, 600, 300, 300, 600, ~0xDCBA987654321, 52, PROTOCOL_IS_LSB_FIRST, 0, 0);
checkReceivedRawData(0xDCBA987654321); checkReceivedRawData(0xDCBA987654321);
# endif
delay(DELAY_AFTER_SEND); delay(DELAY_AFTER_SEND);
Serial.println(F("Send 7 bit ASCII character with PulseDistanceWidth LSB first")); Serial.println(F("Send 7 bit ASCII character with PulseDistanceWidth LSB first"));
@ -635,23 +518,12 @@ void loop() {
# if defined(DECODE_MAGIQUEST) # if defined(DECODE_MAGIQUEST)
Serial.println(F("Send MagiQuest 0x6BCDFF00, 0x176 as 55 bit PulseDistanceWidth MSB first")); Serial.println(F("Send MagiQuest 0x6BCDFF00, 0x176 as 55 bit PulseDistanceWidth MSB first"));
Serial.flush(); Serial.flush();
# if __INT_WIDTH__ < 32
tRawData[0] = 0x01AF37FC; // We have 1 header (start) bit and 7 start bits and 31 address bits for MagiQuest, so 0x6BCDFF00 is shifted 2 left
tRawData[1] = 0x017619; // We send only 23 bits here! 0x19 is the checksum
IrSender.sendPulseDistanceWidthFromArray(38, 287, 864, 576, 576, 287, 864, &tRawData[0], 55,
PROTOCOL_IS_MSB_FIRST | SUPPRESS_STOP_BIT, 0, 0);
# else
// 0xD79BFE00 is 0x6BCDFF00 is shifted 1 left // 0xD79BFE00 is 0x6BCDFF00 is shifted 1 left
IrSender.sendPulseDistanceWidth(38, 287, 864, 576, 576, 287, 864, 0xD79BFE017619, 55, PROTOCOL_IS_MSB_FIRST, 0, 0); IrSender.sendPulseDistanceWidth(38, 287, 864, 576, 576, 287, 864, 0xD79BFE017619, 55, PROTOCOL_IS_MSB_FIRST, 0, 0);
# endif
checkReceive(0xFF00, 0x176); checkReceive(0xFF00, 0x176);
if (IrReceiver.decodedIRData.decodedRawData != 0x6BCDFF00) { if (IrReceiver.decodedIRData.decodedRawData != 0x6BCDFF00) {
Serial.print(F("ERROR: Received address=0x")); Serial.print(F("ERROR: Received address=0x"));
#if (__INT_WIDTH__ < 32)
Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX); Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX);
#else
PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawData, HEX);
#endif
Serial.println(F(" != sent address=0x6BCDFF00")); Serial.println(F(" != sent address=0x6BCDFF00"));
Serial.println(); Serial.println();
} }
@ -659,7 +531,6 @@ void loop() {
# endif // defined(DECODE_MAGIQUEST) # endif // defined(DECODE_MAGIQUEST)
} }
#endif // if FLASHEND >= 0x3FFF
Serial.println(F("Send Onkyo (NEC with 16 bit command)")); Serial.println(F("Send Onkyo (NEC with 16 bit command)"));
Serial.flush(); Serial.flush();