Implemented feedback for send. Removed decode_results results. Added unit test and fixed LG send bug. MATCH_MARK() etc. now available as matchMark(). Added PinDefinitionsAndMore.h.

This commit is contained in:
Armin 2021-03-08 21:38:06 +01:00
parent 0bd9f4698f
commit 2ccae65ef6
52 changed files with 2411 additions and 1592 deletions

View File

@ -104,13 +104,13 @@ jobs:
- arduino-boards-fqbn: digistump:avr:digispark-tiny:clock=clock1
platform-url: https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json
sketches-exclude: IR2Keyboard,IRUnitTest,IRrelay,ReceiveAndSend,IRreceiveDump,IRsendProntoDemo,MicroGirs,IRDispatcherDemo,LGAirConditionerSendDemo,ReceiverTimingAnalysis # Does not fit in FLASH or RAM, missing digitalPinToInterrupt
sketches-exclude: IR2Keyboard,UnitTest,ControlRelay,ReceiveAndSend,ReceiveDump,SendProntoDemo,MicroGirs,IRDispatcherDemo,SendLGAirConditionerDemo,ReceiverTimingAnalysis # Does not fit in FLASH or RAM, missing digitalPinToInterrupt
build-properties: # the flags were put in compiler.cpp.extra_flags
All: -DEXCLUDE_EXOTIC_PROTOCOLS
- arduino-boards-fqbn: ATTinyCore:avr:attinyx5:chip=85,clock=1internal
platform-url: http://drazzy.com/package_drazzy.com_index.json
sketches-exclude: IR2Keyboard,IRUnitTest,IRrelay,ReceiveAndSend,IRreceiveDump,IRsendProntoDemo,MicroGirs,IRDispatcherDemo,LGAirConditionerSendDemo,ReceiverTimingAnalysis # Does not fit in FLASH or RAM
sketches-exclude: IR2Keyboard,UnitTest,ReceiveAndSend,ReceiveDump,SendProntoDemo,MicroGirs,IRDispatcherDemo,SendLGAirConditionerDemo,ReceiverTimingAnalysis # Does not fit in FLASH or RAM
build-properties: # the flags were put in compiler.cpp.extra_flags
All: -DEXCLUDE_EXOTIC_PROTOCOLS

View File

@ -32,13 +32,13 @@ This is a quite old but maybe useful wiki for this library.
# Converting your program to the 3.1 version
This must be done also for all versions > 3.0.1 if `USE_NO_SEND_PWM` is defined.<br/>
Starting with this version, **the generation of PWM is done by software**, thus saving the hardware timer and **enabling abitrary output pins**.<br/>
Therefore you must change all `IrSender.begin(true);` by `IrSender.begin(IR_SEND_PIN, true);`.
Therefore you must change all `IrSender.begin(true);` by `IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK);`.
# Converting your 2.x program to the 3.x version
- Now there is an **IRreceiver** and **IRsender** object like the well known Arduino **Serial** object.
- Just remove the line `IRrecv IrReceiver(IR_RECEIVE_PIN);` and/or `IRsend IrSender;` in your program, and replace all occurrences of `IRrecv.` or `irrecv.` with `IrReceiver`.
- Since the decoded values are now in `IrReceiver.decodedIRData` and not in `results` any more, remove the line `decode_results results` or similar.
- Like for the Serial object, call [`IrReceiver.begin(IR_RECEIVE_PIN, ENABE_ED_FEEDBACK);`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/IRreceiveDemo/IRreceiveDemo.ino#L38) or `IrReceiver.begin(IR_RECEIVE_PIN, DISABLE_LED_FEEDBACK);` instead of the `IrReceiver.enableIRIn();` or `irrecv.enableIRIn();` in setup().
- Like for the Serial object, call [`IrReceiver.begin(IR_RECEIVE_PIN, ENABE_ED_FEEDBACK);`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/ReceiveDemo/ReceiveDemo.ino#L38) or `IrReceiver.begin(IR_RECEIVE_PIN, DISABLE_LED_FEEDBACK);` instead of the `IrReceiver.enableIRIn();` or `irrecv.enableIRIn();` in setup().
- Old `decode(decode_results *aResults)` function is replaced by simple `decode()`. So if you have a statement `if(irrecv.decode(&results))` replace it with `if (IrReceiver.decode())`.
- The decoded result is now in in `IrReceiver.decodedIRData` and not in `results` any more, therefore replace any occurrences of `results.value` and / or `results.decode_type` (and similar) to `IrReceiver.decodedIRData.decodedRawData` and / or `IrReceiver.decodedIRData.decodedRawData`.
- Overflow, Repeat and other flags are now in [`IrReceiver.receivedIRData.flags`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/IRremote.h#L126).
@ -69,8 +69,8 @@ The main reason is, that it was designed to fit inside MCUs with relatively low
## Hints
If you do not know which protocol your IR transmitter uses, you have several choices.
- Use the [IRreceiveDump example](examples/IRreceiveDump) to dump out the IR timing.
You can then reproduce/send this timing with the [IRsendRawDemo example](examples/IRsendRawDemo).
- Use the [IRreceiveDump example](examples/ReceiveDump) to dump out the IR timing.
You can then reproduce/send this timing with the [SendRawDemo example](examples/SendRawDemo).
For **long codes** with more than 48 bits like from air conditioners, you can **change the length of the input buffer** in [IRremote.h](src/IRremoteInt.h#L36).
- The [IRMP AllProtocol example](https://github.com/ukw100/IRMP#allprotocol-example) prints the protocol and data for one of the **40 supported protocols**.
The same library can be used to send this codes.
@ -86,7 +86,7 @@ If you do not know which protocol your IR transmitter uses, you have several cho
### SimpleReceiver + SimpleSender
This examples are a good starting point.
### IRReceiveDemo + IRSendDemo
### ReceiveDemo + SendDemo
More complete examples for the advanced user.
### ReceiveAndSend
@ -95,7 +95,7 @@ Like the name states...
### MinimalReceiver + SmallReceiver
If code size matters look at these examples.
### DispatcherDemo
### IRDispatcherDemo
Framework for calling different functions for different IR codes.
### IRrelay
@ -113,11 +113,12 @@ Modify it by commenting them out or in, or change the values if applicable. Or d
| `MARK_EXCESS_MICROS` | Before `#include <IRremote.h>` | 20 | MARK_EXCESS_MICROS is subtracted from all marks and added to all spaces before decoding, to compensate for the signal forming of different IR receiver modules. |
| `USE_NO_SEND_PWM` | Before `#include <IRremote.h>` | disabled | Use no carrier PWM, just simulate an active low receiver signal. |
| `FEEDBACK_LED_IS_ACTIVE_LOW` | Before `#include <IRremote.h>` | disabled | Required on some boards (like my BluePill and my ESP8266 board), where the feedback LED is active low. |
| `DISABLE_LED_FEEDBACK_FOR_RECEIVE` | Before `#include <IRremote.h>` | disabled | This disables the LED feedback code for receive, thus saving around 108 bytes program space and halving the receiver ISR processing time. |
| `IR_INPUT_IS_ACTIVE_HIGH` | IRremoteInt.h | disabled | Enable it if you use a RF receiver, which has an active HIGH output signal. |
| `RAW_BUFFER_LENGTH` | IRremoteint.h | 101 | Buffer size of raw input buffer. Must be odd! |
| `DEBUG` | IRremoteInt.h | disabled | Enables lots of lovely debug output. |
| `IR_SEND_DUTY_CYCLE` | IRremoteBoardDefs.h | 30 | Duty cycle of IR send signal. |
| `MICROS_PER_TICK` | IRremoteBoardDefs.h | 50 | Resolution of the raw input buffer data. |
| `IR_SEND_DUTY_CYCLE` | IRBoardDefs.h | 30 | Duty cycle of IR send signal. |
| `MICROS_PER_TICK` | IRBoardDefs.h | 50 | Resolution of the raw input buffer data. |
|-|-|-|-|
| `IR_INPUT_PIN` | TinyIRReceiver.h | 2 | The pin number for TinyIRReceiver IR input, which gets compiled in. |
| `IR_FEEDBACK_LED_PIN` | TinyIRReceiver.h | `LED_BUILTIN` | The pin number for TinyIRReceiver feedback LED, which gets compiled in. |
@ -158,7 +159,7 @@ The send PWM signal is by default generated by software. **Therefore every pin c
## Hardware-PWM signal generation for sending
If you define `SEND_PWM_BY_TIMER`, the send PWM signal is generated by a hardware timer. The same timer as for the receiver is used.
Since each hardware timer has its dedicated output pins, you must change timer to change PWN output.<br/>
The timer and the pin usage can be adjusted in [IRremoteBoardDefs.h](src/private/IRremoteBoardDefs.h)
The timer and the pin usage can be adjusted in [IRBoardDefs.h](src/private/IRBoardDefs.h)
| Board/CPU | Hardware-PWM Pin | Timers |
|--------------------------------------------------------------------------|---------------------|-------------------|

View File

@ -9,6 +9,8 @@
- Renamed most irparams_struct values.
- Implemented feedback for send.
- Removed decode_results results.
- Added unit test and fixed LG send bug.
- MATCH_MARK() etc. now available as matchMark().
## 3.0.2
- Bug fix for USE_OLD_DECODE.

View File

@ -1,5 +1,6 @@
/*
* IRremote: IRrelay - demonstrates receiving IR codes with IRrecv
* ControlRelay.cpp
*
* Toggles an output pin at each command received
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Initially coded 2009 Ken Shirriff http://www.righto.com
@ -9,7 +10,7 @@
************************************************************************************
* MIT License
*
* Copyright (c) 2020-2021 Armin Joachimsmeyer
* Copyright (c) 2009-2021 Ken Shirriff, 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
@ -39,7 +40,11 @@
#include <IRremote.h>
int RELAY_PIN = 4; // is labeled D2 on the Chinese SAMD21 M0-Mini clone
#if defined(APPLICATION_PIN)
#define RELAY_PIN APPLICATION_PIN
#else
#define RELAY_PIN 5
#endif
void setup() {
pinMode(LED_BUILTIN, OUTPUT);

View File

@ -9,7 +9,7 @@
*
* This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* IRMP is free software: you can redistribute it and/or modify
* 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.
@ -44,19 +44,19 @@
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
@ -101,34 +101,58 @@
#define IR_SEND_PIN 11
#define TONE_PIN 3
# 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
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(TEENSYDUINO)
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(__AVR__)
#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 IR_TIMING_TEST_PIN 6
#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
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
#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 IR_TIMING_TEST_PIN 6
#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
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
@ -146,10 +170,12 @@
#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 IR_TIMING_TEST_PIN 6
#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)
/*

View File

@ -64,8 +64,8 @@
#include "PinDefinitionsAndMore.h"
#define IR_RECEIVER_PIN IRMP_INPUT_PIN
#if defined(ALTERNATIVE_IRMP_FEEDBACK_LED_PIN)
#define FEEDBACK_LED_PIN ALTERNATIVE_IRMP_FEEDBACK_LED_PIN
#if defined(ALTERNATIVE_IR_FEEDBACK_LED_PIN)
#define FEEDBACK_LED_PIN ALTERNATIVE_IR_FEEDBACK_LED_PIN
#endif
//#define IRMP_ENABLE_PIN_CHANGE_INTERRUPT // Enable interrupt functionality - requires around 376 additional bytes of program space
@ -76,8 +76,8 @@
#define IRMP_SUPPORT_NEC_PROTOCOL 1 // this enables only one protocol
# ifdef ALTERNATIVE_IRMP_FEEDBACK_LED_PIN
#define IRMP_FEEDBACK_LED_PIN ALTERNATIVE_IRMP_FEEDBACK_LED_PIN
# ifdef ALTERNATIVE_IR_FEEDBACK_LED_PIN
#define IRMP_FEEDBACK_LED_PIN ALTERNATIVE_IR_FEEDBACK_LED_PIN
# endif
/*
* After setting the definitions we can include the code and compile it.
@ -149,9 +149,9 @@ void setup()
Serial.println(F("at pin " STR(IRMP_INPUT_PIN)));
# endif
# ifdef ALTERNATIVE_IRMP_FEEDBACK_LED_PIN
irmp_irsnd_LEDFeedback(true); // Enable receive signal feedback at ALTERNATIVE_IRMP_FEEDBACK_LED_PIN
Serial.print(F("IR feedback pin is " STR(ALTERNATIVE_IRMP_FEEDBACK_LED_PIN)));
# ifdef ALTERNATIVE_IR_FEEDBACK_LED_PIN
irmp_irsnd_LEDFeedback(true); // Enable receive signal feedback at ALTERNATIVE_IR_FEEDBACK_LED_PIN
Serial.print(F("IR feedback pin is " STR(ALTERNATIVE_IR_FEEDBACK_LED_PIN)));
# endif
#endif

View File

@ -1,244 +0,0 @@
START ../src/IRreceiveDemo.cpp from Jan 14 2021
Using library version 2.9.0
Enabling IRin
Ready to receive IR signals at pin 11
Protocol=NEC Address=0x2 Command=0x34 Raw-Data=0xCB34FD02 (32 bits)
Protocol=NEC Address=0x102 Command=0x34 Raw-Data=0xCB340102 (32 bits)
Protocol=NEC Address=0x80 Command=0x45 Raw-Data=0xBA457F80 (32 bits)
Protocol=PANASONIC Address=0x102 Command=0x34 Raw-Data=0x4341020 (48 bits)
Protocol=KASEIKYO Address=0x4711102 Command=0x34 Raw-Data=0x7341023 (48 bits)
Protocol=DENON Address=0x2 Command=0x34 Raw-Data=0x8D0 (15 bits)
Protocol=DENON Address=0x2 Command=0x34 Auto-repeat gap=37150us Raw-Data=0xB2F (15 bits)
Protocol=SHARP Address=0x2 Command=0x34 Raw-Data=0x8D2 (15 bits)
Protocol=SHARP Address=0x2 Command=0x34 Auto-repeat gap=36700us Raw-Data=0xB2D (15 bits)
Protocol=SONY Address=0x2 Command=0x34 Raw-Data=0x134 (12 bits)
Protocol=SONY Address=0x2 Command=0x34 Raw-Data=0x8134 (20 bits)
Protocol=RC5 Address=0x2 Command=0x34 Toggle=1 Raw-Data=0x38B4 (13 bits)
Protocol=RC5 Address=0x2 Command=0x74 Raw-Data=0x20B4 (13 bits)
Protocol=RC6 Address=0x2 Command=0x34 Toggle=1 Raw-Data=0x234 (16 bits)
Protocol=SAMSUNG Address=0x102 Command=0x34 Raw-Data=0x340102 (32 bits)
Protocol=JVC Address=0x2 Command=0x34 Raw-Data=0x3402 (16 bits)
Protocol=LG Address=0x2 Command=0x34 Raw-Data=0x200347 (28 bits)
Protocol=BOSEWAVE Address=0x0 Command=0x34 Raw-Data=0xCB34 (16 bits)
Protocol=LEGO_PF Address=0x21 Command=0x4 Raw-Data=0x2148 (16 bits)
Protocol=LEGO_PF Address=0x21 Command=0x4 Auto-repeat gap=38578us Raw-Data=0x2148 (16 bits)
Protocol=LEGO_PF Address=0x21 Command=0x4 Auto-repeat gap=38728us Raw-Data=0x2148 (16 bits)
Protocol=LEGO_PF Address=0x21 Command=0x4 Auto-repeat gap=38678us Raw-Data=0x2148 (16 bits)
Protocol=LEGO_PF Address=0x21 Command=0x4 Auto-repeat gap=38728us Raw-Data=0x2148 (16 bits)
Protocol=NEC Address=0x3 Command=0x45 Raw-Data=0xBA45FC03 (32 bits)
Protocol=NEC Address=0x3 Command=0x45 Repeat gap=40100us Raw-Data=0x0 (0 bits)
Protocol=NEC Address=0x203 Command=0x45 Raw-Data=0xBA450203 (32 bits)
Protocol=NEC Address=0x203 Command=0x45 Repeat gap=40850us Raw-Data=0x0 (0 bits)
Protocol=NEC Address=0x80 Command=0x45 Raw-Data=0xBA457F80 (32 bits)
Protocol=PANASONIC Address=0x203 Command=0x45 Raw-Data=0x55452030 (48 bits)
Protocol=PANASONIC Address=0x203 Command=0x45 Repeat gap=66550us Raw-Data=0x55452030 (48 bits)
Protocol=KASEIKYO Address=0x4711203 Command=0x45 Raw-Data=0x56452033 (48 bits)
Protocol=KASEIKYO Address=0x4711203 Command=0x45 Repeat gap=65200us Raw-Data=0x56452033 (48 bits)
Protocol=DENON Address=0x3 Command=0x45 Raw-Data=0xD14 (15 bits)
Protocol=DENON Address=0x3 Command=0x45 Auto-repeat gap=36700us Raw-Data=0xEEB (15 bits)
Protocol=DENON Address=0x3 Command=0x45 Repeat gap=37100us Raw-Data=0xD14 (15 bits)
Protocol=DENON Address=0x3 Command=0x45 Auto-repeat gap=37400us Repeat gap=37400us Raw-Data=0xEEB (15 bits)
Protocol=SHARP Address=0x3 Command=0x45 Raw-Data=0xD16 (15 bits)
Protocol=SHARP Address=0x3 Command=0x45 Auto-repeat gap=37550us Raw-Data=0xEE9 (15 bits)
Protocol=SHARP Address=0x3 Command=0x45 Repeat gap=37550us Raw-Data=0xD16 (15 bits)
Protocol=SHARP Address=0x3 Command=0x45 Auto-repeat gap=35850us Repeat gap=35850us Raw-Data=0xEE9 (15 bits)
Protocol=SONY Address=0x3 Command=0x45 Raw-Data=0x1C5 (12 bits)
Protocol=SONY Address=0x3 Command=0x45 Repeat gap=17200us Raw-Data=0x1C5 (12 bits)
Protocol=SONY Address=0x3 Command=0x45 Raw-Data=0x101C5 (20 bits)
Protocol=SONY Address=0x3 Command=0x45 Repeat gap=17650us Raw-Data=0x101C5 (20 bits)
Protocol=RC5 Address=0x3 Command=0x45 Raw-Data=0x20C5 (13 bits)
Protocol=RC5 Address=0x3 Command=0x45 Repeat gap=91100us Raw-Data=0x20C5 (13 bits)
Protocol=RC5 Address=0x3 Command=0x45 Toggle=1 Raw-Data=0x28C5 (13 bits)
Protocol=RC5 Address=0x3 Command=0x45 Toggle=1 Repeat gap=91900us Raw-Data=0x28C5 (13 bits)
Protocol=RC6 Address=0x3 Command=0x45 Raw-Data=0x345 (16 bits)
Protocol=RC6 Address=0x3 Command=0x45 Repeat gap=99650us Raw-Data=0x345 (16 bits)
Protocol=SAMSUNG Address=0x203 Command=0x45 Raw-Data=0x450203 (32 bits)
Protocol=SAMSUNG Address=0x203 Command=0x45 Repeat gap=47350us Raw-Data=0x0 (0 bits)
Protocol=JVC Address=0x3 Command=0x45 Raw-Data=0x4503 (16 bits)
Protocol=JVC Address=0x81 Command=0x22 Repeat gap=15700us Raw-Data=0x2281 (16 bits)
Protocol=LG Address=0x3 Command=0x45 Raw-Data=0x300459 (28 bits)
Protocol=LG Address=0x3 Command=0x45 Repeat gap=43850us Raw-Data=0x0 (0 bits)
Protocol=BOSEWAVE Address=0x0 Command=0x45 Raw-Data=0xBA45 (16 bits)
Protocol=BOSEWAVE Address=0x0 Command=0x45 Repeat gap=43600us Raw-Data=0xBA45 (16 bits)
Protocol=LEGO_PF Address=0x31 Command=0x5 Raw-Data=0x3158 (16 bits)
Protocol=LEGO_PF Address=0x31 Command=0x5 Auto-repeat gap=13142us Raw-Data=0x3158 (16 bits)
Protocol=LEGO_PF Address=0x31 Command=0x5 Auto-repeat gap=12742us Raw-Data=0x3158 (16 bits)
Protocol=LEGO_PF Address=0x31 Command=0x5 Auto-repeat gap=12842us Raw-Data=0x3158 (16 bits)
Protocol=LEGO_PF Address=0x31 Command=0x5 Auto-repeat gap=12742us Raw-Data=0x3158 (16 bits)
Protocol=NEC Address=0x4 Command=0x56 Raw-Data=0xA956FB04 (32 bits)
Protocol=NEC Address=0x4 Command=0x56 Repeat gap=40050us Raw-Data=0x0 (0 bits)
Protocol=NEC Address=0x4 Command=0x56 Repeat gap=88150us Raw-Data=0x0 (0 bits)
Protocol=NEC Address=0x304 Command=0x56 Raw-Data=0xA9560304 (32 bits)
Protocol=NEC Address=0x304 Command=0x56 Repeat gap=40550us Raw-Data=0x0 (0 bits)
Protocol=NEC Address=0x304 Command=0x56 Repeat gap=88100us Raw-Data=0x0 (0 bits)
Protocol=NEC Address=0x80 Command=0x45 Raw-Data=0xBA457F80 (32 bits)
Protocol=PANASONIC Address=0x304 Command=0x56 Raw-Data=0x26563040 (48 bits)
Protocol=PANASONIC Address=0x304 Command=0x56 Repeat gap=66550us Raw-Data=0x26563040 (48 bits)
Protocol=PANASONIC Address=0x304 Command=0x56 Repeat gap=65850us Raw-Data=0x26563040 (48 bits)
Protocol=KASEIKYO Address=0x4711304 Command=0x56 Raw-Data=0x25563043 (48 bits)
Protocol=KASEIKYO Address=0x4711304 Command=0x56 Repeat gap=65200us Raw-Data=0x25563043 (48 bits)
Protocol=KASEIKYO Address=0x4711304 Command=0x56 Repeat gap=65850us Raw-Data=0x25563043 (48 bits)
Protocol=DENON Address=0x4 Command=0x56 Raw-Data=0x1158 (15 bits)
Protocol=DENON Address=0x4 Command=0x56 Auto-repeat gap=37400us Raw-Data=0x12A7 (15 bits)
Protocol=DENON Address=0x4 Command=0x56 Repeat gap=37750us Raw-Data=0x1158 (15 bits)
Protocol=DENON Address=0x4 Command=0x56 Auto-repeat gap=38000us Repeat gap=38000us Raw-Data=0x12A7 (15 bits)
Protocol=DENON Address=0x4 Command=0x56 Repeat gap=37750us Raw-Data=0x1158 (15 bits)
Protocol=DENON Address=0x4 Command=0x56 Auto-repeat gap=37150us Repeat gap=37150us Raw-Data=0x12A7 (15 bits)
Protocol=SHARP Address=0x4 Command=0x56 Raw-Data=0x115A (15 bits)
Protocol=SHARP Address=0x4 Command=0x56 Auto-repeat gap=37800us Raw-Data=0x12A5 (15 bits)
Protocol=SHARP Address=0x4 Command=0x56 Repeat gap=37000us Raw-Data=0x115A (15 bits)
Protocol=SHARP Address=0x4 Command=0x56 Auto-repeat gap=37400us Repeat gap=37400us Raw-Data=0x12A5 (15 bits)
Protocol=SHARP Address=0x4 Command=0x56 Repeat gap=37000us Raw-Data=0x115A (15 bits)
Protocol=SHARP Address=0x4 Command=0x56 Auto-repeat gap=37350us Repeat gap=37350us Raw-Data=0x12A5 (15 bits)
Protocol=SONY Address=0x4 Command=0x56 Raw-Data=0x256 (12 bits)
Protocol=SONY Address=0x4 Command=0x56 Repeat gap=17400us Raw-Data=0x256 (12 bits)
Protocol=SONY Address=0x4 Command=0x56 Repeat gap=16950us Raw-Data=0x256 (12 bits)
Protocol=SONY Address=0x4 Command=0x56 Raw-Data=0x18256 (20 bits)
Protocol=SONY Address=0x4 Command=0x56 Repeat gap=17600us Raw-Data=0x18256 (20 bits)
Protocol=SONY Address=0x4 Command=0x56 Repeat gap=16950us Raw-Data=0x18256 (20 bits)
Protocol=RC5 Address=0x4 Command=0x56 Toggle=1 Raw-Data=0x2916 (13 bits)
Protocol=RC5 Address=0x4 Command=0x56 Toggle=1 Repeat gap=93150us Raw-Data=0x2916 (13 bits)
Protocol=RC5 Address=0x4 Command=0x56 Toggle=1 Repeat gap=92050us Raw-Data=0x2916 (13 bits)
Protocol=RC5 Address=0x4 Command=0x56 Raw-Data=0x2116 (13 bits)
Protocol=RC5 Address=0x4 Command=0x56 Repeat gap=92100us Raw-Data=0x2116 (13 bits)
Protocol=RC5 Address=0x4 Command=0x56 Repeat gap=92000us Raw-Data=0x2116 (13 bits)
Protocol=RC6 Address=0x4 Command=0x56 Toggle=1 Raw-Data=0x456 (16 bits)
Protocol=RC6 Address=0x4 Command=0x56 Toggle=1 Repeat gap=99500us Raw-Data=0x456 (16 bits)
Protocol=RC6 Address=0x4 Command=0x56 Toggle=1 Repeat gap=99350us Raw-Data=0x456 (16 bits)
Protocol=SAMSUNG Address=0x304 Command=0x56 Raw-Data=0x560304 (32 bits)
Protocol=SAMSUNG Address=0x304 Command=0x56 Repeat gap=46800us Raw-Data=0x0 (0 bits)
Protocol=SAMSUNG Address=0x304 Command=0x56 Repeat gap=90600us Raw-Data=0x0 (0 bits)
Protocol=JVC Address=0x4 Command=0x56 Raw-Data=0x5604 (16 bits)
Protocol=JVC Address=0x2 Command=0x2B Repeat gap=15700us Raw-Data=0x2B02 (16 bits)
Protocol=JVC Address=0x2 Command=0x2B Repeat gap=15550us Raw-Data=0x2B02 (16 bits)
Protocol=LG Address=0x4 Command=0x56 Raw-Data=0x40056B (28 bits)
Protocol=LG Address=0x4 Command=0x56 Repeat gap=44950us Raw-Data=0x0 (0 bits)
Protocol=LG Address=0x4 Command=0x56 Repeat gap=90100us Raw-Data=0x0 (0 bits)
Protocol=BOSEWAVE Address=0x0 Command=0x56 Raw-Data=0xA956 (16 bits)
Protocol=BOSEWAVE Address=0x0 Command=0x56 Repeat gap=43600us Raw-Data=0xA956 (16 bits)
Protocol=BOSEWAVE Address=0x0 Command=0x56 Repeat gap=44100us Raw-Data=0xA956 (16 bits)
Protocol=LEGO_PF Address=0x41 Command=0x6 Raw-Data=0x416C (16 bits)
Protocol=LEGO_PF Address=0x41 Command=0x6 Auto-repeat gap=25264us Raw-Data=0x416C (16 bits)
Protocol=LEGO_PF Address=0x41 Command=0x6 Auto-repeat gap=25314us Raw-Data=0x416C (16 bits)
Protocol=LEGO_PF Address=0x41 Command=0x6 Auto-repeat gap=25064us Raw-Data=0x416C (16 bits)
Protocol=LEGO_PF Address=0x41 Command=0x6 Auto-repeat gap=25214us Raw-Data=0x416C (16 bits)

View File

@ -99,10 +99,8 @@ void dumpTIMER() {
}
void dumpTimerPin() {
#if defined(SENDING_SUPPORTED)
Serial.print(F("IR Tx Pin: "));
Serial.println(IR_SEND_PIN);
#endif
Serial.print(F("IR Send Pin: "));
Serial.println(IrSender.sendPin);
}
void dumpClock() {

View File

@ -1,244 +0,0 @@
START ../src/IRreceiveDemo.cpp from Jan 14 2021
Using library version 2.9.0
Enabling IRin
Ready to receive IR signals at pin 11
Protocol=NEC Address=0x2 Command=0x34 Raw-Data=0xCB34FD02 (32 bits)
Protocol=NEC Address=0x102 Command=0x34 Raw-Data=0xCB340102 (32 bits)
Protocol=NEC Address=0x80 Command=0x45 Raw-Data=0xBA457F80 (32 bits)
Protocol=PANASONIC Address=0x102 Command=0x34 Raw-Data=0x4341020 (48 bits)
Protocol=KASEIKYO Address=0x4711102 Command=0x34 Raw-Data=0x7341023 (48 bits)
Protocol=DENON Address=0x2 Command=0x34 Raw-Data=0x8D0 (15 bits)
Protocol=DENON Address=0x2 Command=0x34 Auto-repeat gap=37150us Raw-Data=0xB2F (15 bits)
Protocol=SHARP Address=0x2 Command=0x34 Raw-Data=0x8D2 (15 bits)
Protocol=SHARP Address=0x2 Command=0x34 Auto-repeat gap=36700us Raw-Data=0xB2D (15 bits)
Protocol=SONY Address=0x2 Command=0x34 Raw-Data=0x134 (12 bits)
Protocol=SONY Address=0x2 Command=0x34 Raw-Data=0x8134 (20 bits)
Protocol=RC5 Address=0x2 Command=0x34 Toggle=1 Raw-Data=0x38B4 (13 bits)
Protocol=RC5 Address=0x2 Command=0x74 Raw-Data=0x20B4 (13 bits)
Protocol=RC6 Address=0x2 Command=0x34 Toggle=1 Raw-Data=0x234 (16 bits)
Protocol=SAMSUNG Address=0x102 Command=0x34 Raw-Data=0x340102 (32 bits)
Protocol=JVC Address=0x2 Command=0x34 Raw-Data=0x3402 (16 bits)
Protocol=LG Address=0x2 Command=0x34 Raw-Data=0x200347 (28 bits)
Protocol=BOSEWAVE Address=0x0 Command=0x34 Raw-Data=0xCB34 (16 bits)
Protocol=LEGO_PF Address=0x21 Command=0x4 Raw-Data=0x2148 (16 bits)
Protocol=LEGO_PF Address=0x21 Command=0x4 Auto-repeat gap=38578us Raw-Data=0x2148 (16 bits)
Protocol=LEGO_PF Address=0x21 Command=0x4 Auto-repeat gap=38728us Raw-Data=0x2148 (16 bits)
Protocol=LEGO_PF Address=0x21 Command=0x4 Auto-repeat gap=38678us Raw-Data=0x2148 (16 bits)
Protocol=LEGO_PF Address=0x21 Command=0x4 Auto-repeat gap=38728us Raw-Data=0x2148 (16 bits)
Protocol=NEC Address=0x3 Command=0x45 Raw-Data=0xBA45FC03 (32 bits)
Protocol=NEC Address=0x3 Command=0x45 Repeat gap=40100us Raw-Data=0x0 (0 bits)
Protocol=NEC Address=0x203 Command=0x45 Raw-Data=0xBA450203 (32 bits)
Protocol=NEC Address=0x203 Command=0x45 Repeat gap=40850us Raw-Data=0x0 (0 bits)
Protocol=NEC Address=0x80 Command=0x45 Raw-Data=0xBA457F80 (32 bits)
Protocol=PANASONIC Address=0x203 Command=0x45 Raw-Data=0x55452030 (48 bits)
Protocol=PANASONIC Address=0x203 Command=0x45 Repeat gap=66550us Raw-Data=0x55452030 (48 bits)
Protocol=KASEIKYO Address=0x4711203 Command=0x45 Raw-Data=0x56452033 (48 bits)
Protocol=KASEIKYO Address=0x4711203 Command=0x45 Repeat gap=65200us Raw-Data=0x56452033 (48 bits)
Protocol=DENON Address=0x3 Command=0x45 Raw-Data=0xD14 (15 bits)
Protocol=DENON Address=0x3 Command=0x45 Auto-repeat gap=36700us Raw-Data=0xEEB (15 bits)
Protocol=DENON Address=0x3 Command=0x45 Repeat gap=37100us Raw-Data=0xD14 (15 bits)
Protocol=DENON Address=0x3 Command=0x45 Auto-repeat gap=37400us Repeat gap=37400us Raw-Data=0xEEB (15 bits)
Protocol=SHARP Address=0x3 Command=0x45 Raw-Data=0xD16 (15 bits)
Protocol=SHARP Address=0x3 Command=0x45 Auto-repeat gap=37550us Raw-Data=0xEE9 (15 bits)
Protocol=SHARP Address=0x3 Command=0x45 Repeat gap=37550us Raw-Data=0xD16 (15 bits)
Protocol=SHARP Address=0x3 Command=0x45 Auto-repeat gap=35850us Repeat gap=35850us Raw-Data=0xEE9 (15 bits)
Protocol=SONY Address=0x3 Command=0x45 Raw-Data=0x1C5 (12 bits)
Protocol=SONY Address=0x3 Command=0x45 Repeat gap=17200us Raw-Data=0x1C5 (12 bits)
Protocol=SONY Address=0x3 Command=0x45 Raw-Data=0x101C5 (20 bits)
Protocol=SONY Address=0x3 Command=0x45 Repeat gap=17650us Raw-Data=0x101C5 (20 bits)
Protocol=RC5 Address=0x3 Command=0x45 Raw-Data=0x20C5 (13 bits)
Protocol=RC5 Address=0x3 Command=0x45 Repeat gap=91100us Raw-Data=0x20C5 (13 bits)
Protocol=RC5 Address=0x3 Command=0x45 Toggle=1 Raw-Data=0x28C5 (13 bits)
Protocol=RC5 Address=0x3 Command=0x45 Toggle=1 Repeat gap=91900us Raw-Data=0x28C5 (13 bits)
Protocol=RC6 Address=0x3 Command=0x45 Raw-Data=0x345 (16 bits)
Protocol=RC6 Address=0x3 Command=0x45 Repeat gap=99650us Raw-Data=0x345 (16 bits)
Protocol=SAMSUNG Address=0x203 Command=0x45 Raw-Data=0x450203 (32 bits)
Protocol=SAMSUNG Address=0x203 Command=0x45 Repeat gap=47350us Raw-Data=0x0 (0 bits)
Protocol=JVC Address=0x3 Command=0x45 Raw-Data=0x4503 (16 bits)
Protocol=JVC Address=0x81 Command=0x22 Repeat gap=15700us Raw-Data=0x2281 (16 bits)
Protocol=LG Address=0x3 Command=0x45 Raw-Data=0x300459 (28 bits)
Protocol=LG Address=0x3 Command=0x45 Repeat gap=43850us Raw-Data=0x0 (0 bits)
Protocol=BOSEWAVE Address=0x0 Command=0x45 Raw-Data=0xBA45 (16 bits)
Protocol=BOSEWAVE Address=0x0 Command=0x45 Repeat gap=43600us Raw-Data=0xBA45 (16 bits)
Protocol=LEGO_PF Address=0x31 Command=0x5 Raw-Data=0x3158 (16 bits)
Protocol=LEGO_PF Address=0x31 Command=0x5 Auto-repeat gap=13142us Raw-Data=0x3158 (16 bits)
Protocol=LEGO_PF Address=0x31 Command=0x5 Auto-repeat gap=12742us Raw-Data=0x3158 (16 bits)
Protocol=LEGO_PF Address=0x31 Command=0x5 Auto-repeat gap=12842us Raw-Data=0x3158 (16 bits)
Protocol=LEGO_PF Address=0x31 Command=0x5 Auto-repeat gap=12742us Raw-Data=0x3158 (16 bits)
Protocol=NEC Address=0x4 Command=0x56 Raw-Data=0xA956FB04 (32 bits)
Protocol=NEC Address=0x4 Command=0x56 Repeat gap=40050us Raw-Data=0x0 (0 bits)
Protocol=NEC Address=0x4 Command=0x56 Repeat gap=88150us Raw-Data=0x0 (0 bits)
Protocol=NEC Address=0x304 Command=0x56 Raw-Data=0xA9560304 (32 bits)
Protocol=NEC Address=0x304 Command=0x56 Repeat gap=40550us Raw-Data=0x0 (0 bits)
Protocol=NEC Address=0x304 Command=0x56 Repeat gap=88100us Raw-Data=0x0 (0 bits)
Protocol=NEC Address=0x80 Command=0x45 Raw-Data=0xBA457F80 (32 bits)
Protocol=PANASONIC Address=0x304 Command=0x56 Raw-Data=0x26563040 (48 bits)
Protocol=PANASONIC Address=0x304 Command=0x56 Repeat gap=66550us Raw-Data=0x26563040 (48 bits)
Protocol=PANASONIC Address=0x304 Command=0x56 Repeat gap=65850us Raw-Data=0x26563040 (48 bits)
Protocol=KASEIKYO Address=0x4711304 Command=0x56 Raw-Data=0x25563043 (48 bits)
Protocol=KASEIKYO Address=0x4711304 Command=0x56 Repeat gap=65200us Raw-Data=0x25563043 (48 bits)
Protocol=KASEIKYO Address=0x4711304 Command=0x56 Repeat gap=65850us Raw-Data=0x25563043 (48 bits)
Protocol=DENON Address=0x4 Command=0x56 Raw-Data=0x1158 (15 bits)
Protocol=DENON Address=0x4 Command=0x56 Auto-repeat gap=37400us Raw-Data=0x12A7 (15 bits)
Protocol=DENON Address=0x4 Command=0x56 Repeat gap=37750us Raw-Data=0x1158 (15 bits)
Protocol=DENON Address=0x4 Command=0x56 Auto-repeat gap=38000us Repeat gap=38000us Raw-Data=0x12A7 (15 bits)
Protocol=DENON Address=0x4 Command=0x56 Repeat gap=37750us Raw-Data=0x1158 (15 bits)
Protocol=DENON Address=0x4 Command=0x56 Auto-repeat gap=37150us Repeat gap=37150us Raw-Data=0x12A7 (15 bits)
Protocol=SHARP Address=0x4 Command=0x56 Raw-Data=0x115A (15 bits)
Protocol=SHARP Address=0x4 Command=0x56 Auto-repeat gap=37800us Raw-Data=0x12A5 (15 bits)
Protocol=SHARP Address=0x4 Command=0x56 Repeat gap=37000us Raw-Data=0x115A (15 bits)
Protocol=SHARP Address=0x4 Command=0x56 Auto-repeat gap=37400us Repeat gap=37400us Raw-Data=0x12A5 (15 bits)
Protocol=SHARP Address=0x4 Command=0x56 Repeat gap=37000us Raw-Data=0x115A (15 bits)
Protocol=SHARP Address=0x4 Command=0x56 Auto-repeat gap=37350us Repeat gap=37350us Raw-Data=0x12A5 (15 bits)
Protocol=SONY Address=0x4 Command=0x56 Raw-Data=0x256 (12 bits)
Protocol=SONY Address=0x4 Command=0x56 Repeat gap=17400us Raw-Data=0x256 (12 bits)
Protocol=SONY Address=0x4 Command=0x56 Repeat gap=16950us Raw-Data=0x256 (12 bits)
Protocol=SONY Address=0x4 Command=0x56 Raw-Data=0x18256 (20 bits)
Protocol=SONY Address=0x4 Command=0x56 Repeat gap=17600us Raw-Data=0x18256 (20 bits)
Protocol=SONY Address=0x4 Command=0x56 Repeat gap=16950us Raw-Data=0x18256 (20 bits)
Protocol=RC5 Address=0x4 Command=0x56 Toggle=1 Raw-Data=0x2916 (13 bits)
Protocol=RC5 Address=0x4 Command=0x56 Toggle=1 Repeat gap=93150us Raw-Data=0x2916 (13 bits)
Protocol=RC5 Address=0x4 Command=0x56 Toggle=1 Repeat gap=92050us Raw-Data=0x2916 (13 bits)
Protocol=RC5 Address=0x4 Command=0x56 Raw-Data=0x2116 (13 bits)
Protocol=RC5 Address=0x4 Command=0x56 Repeat gap=92100us Raw-Data=0x2116 (13 bits)
Protocol=RC5 Address=0x4 Command=0x56 Repeat gap=92000us Raw-Data=0x2116 (13 bits)
Protocol=RC6 Address=0x4 Command=0x56 Toggle=1 Raw-Data=0x456 (16 bits)
Protocol=RC6 Address=0x4 Command=0x56 Toggle=1 Repeat gap=99500us Raw-Data=0x456 (16 bits)
Protocol=RC6 Address=0x4 Command=0x56 Toggle=1 Repeat gap=99350us Raw-Data=0x456 (16 bits)
Protocol=SAMSUNG Address=0x304 Command=0x56 Raw-Data=0x560304 (32 bits)
Protocol=SAMSUNG Address=0x304 Command=0x56 Repeat gap=46800us Raw-Data=0x0 (0 bits)
Protocol=SAMSUNG Address=0x304 Command=0x56 Repeat gap=90600us Raw-Data=0x0 (0 bits)
Protocol=JVC Address=0x4 Command=0x56 Raw-Data=0x5604 (16 bits)
Protocol=JVC Address=0x2 Command=0x2B Repeat gap=15700us Raw-Data=0x2B02 (16 bits)
Protocol=JVC Address=0x2 Command=0x2B Repeat gap=15550us Raw-Data=0x2B02 (16 bits)
Protocol=LG Address=0x4 Command=0x56 Raw-Data=0x40056B (28 bits)
Protocol=LG Address=0x4 Command=0x56 Repeat gap=44950us Raw-Data=0x0 (0 bits)
Protocol=LG Address=0x4 Command=0x56 Repeat gap=90100us Raw-Data=0x0 (0 bits)
Protocol=BOSEWAVE Address=0x0 Command=0x56 Raw-Data=0xA956 (16 bits)
Protocol=BOSEWAVE Address=0x0 Command=0x56 Repeat gap=43600us Raw-Data=0xA956 (16 bits)
Protocol=BOSEWAVE Address=0x0 Command=0x56 Repeat gap=44100us Raw-Data=0xA956 (16 bits)
Protocol=LEGO_PF Address=0x41 Command=0x6 Raw-Data=0x416C (16 bits)
Protocol=LEGO_PF Address=0x41 Command=0x6 Auto-repeat gap=25264us Raw-Data=0x416C (16 bits)
Protocol=LEGO_PF Address=0x41 Command=0x6 Auto-repeat gap=25314us Raw-Data=0x416C (16 bits)
Protocol=LEGO_PF Address=0x41 Command=0x6 Auto-repeat gap=25064us Raw-Data=0x416C (16 bits)
Protocol=LEGO_PF Address=0x41 Command=0x6 Auto-repeat gap=25214us Raw-Data=0x416C (16 bits)

View File

@ -1,159 +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 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
*
* This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* IRMP 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
* -----------------------------------------
* DEFAULT/AVR 2 3 4
* ATtinyX5 0 4 3
* ATtin167 9 8 5 // Digispark pro number schema
* ATtin167 3 2 7
* ATtin3217 10 11 3 // TinyCore schema
* SAMD21 3 4 5
* ESP8266 14 // D5 12 // D6 %
* ESP32 15 4 %
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
*/
//#define IRMP_MEASURE_TIMING // For debugging purposes.
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
// Timer 3 of IRMP 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
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
//#include "ATtinySerialOut.h"
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
# if defined(ARDUINO_AVR_DIGISPARK)
#define LED_BUILTIN PB1
# endif
#define IR_RECEIVE_PIN 0
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
#define TONE_PIN 3
//#define IR_TIMING_TEST_PIN 3
# else
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.
# if defined(ARDUINO_AVR_DIGISPARKPRO)
#define LED_BUILTIN 1 // PB1 - on Digispark board labeled as pin 1 / for ATtinyCore lib use D9
#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
#define IR_TIMING_TEST_PIN 10 // PA4
# else
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 2
#define TONE_PIN 7
# endif
# endif
#elif defined(__AVR_ATtiny3217__)
#define IR_RECEIVE_PIN 10
#define IR_SEND_PIN 11
#define TONE_PIN 3
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#elif defined(TEENSYDUINO)
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#elif defined(__AVR__)
#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 IR_TIMING_TEST_PIN 6
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
#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 IR_TIMING_TEST_PIN 6
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
// Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13/PA17.
// Attention!!! D2 and D4 are switched 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
#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 IR_TIMING_TEST_PIN 6
#endif // defined(ESP8266)
/*
* Helper macro for getting a macro definition as string
*/
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

View File

@ -1,159 +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 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
*
* This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* IRMP 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
* -----------------------------------------
* DEFAULT/AVR 2 3 4
* ATtinyX5 0 4 3
* ATtin167 9 8 5 // Digispark pro number schema
* ATtin167 3 2 7
* ATtin3217 10 11 3 // TinyCore schema
* SAMD21 3 4 5
* ESP8266 14 // D5 12 // D6 %
* ESP32 15 4 %
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
*/
//#define IRMP_MEASURE_TIMING // For debugging purposes.
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
// Timer 3 of IRMP 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
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
//#include "ATtinySerialOut.h"
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
# if defined(ARDUINO_AVR_DIGISPARK)
#define LED_BUILTIN PB1
# endif
#define IR_RECEIVE_PIN 0
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
#define TONE_PIN 3
//#define IR_TIMING_TEST_PIN 3
# else
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.
# if defined(ARDUINO_AVR_DIGISPARKPRO)
#define LED_BUILTIN 1 // PB1 - on Digispark board labeled as pin 1 / for ATtinyCore lib use D9
#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
#define IR_TIMING_TEST_PIN 10 // PA4
# else
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 2
#define TONE_PIN 7
# endif
# endif
#elif defined(__AVR_ATtiny3217__)
#define IR_RECEIVE_PIN 10
#define IR_SEND_PIN 11
#define TONE_PIN 3
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#elif defined(TEENSYDUINO)
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#elif defined(__AVR__)
#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 IR_TIMING_TEST_PIN 6
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
#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 IR_TIMING_TEST_PIN 6
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
// Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13/PA17.
// Attention!!! D2 and D4 are switched 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
#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 IR_TIMING_TEST_PIN 6
#endif // defined(ESP8266)
/*
* Helper macro for getting a macro definition as string
*/
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

View File

@ -1,159 +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 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
*
* This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* IRMP 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
* -----------------------------------------
* DEFAULT/AVR 2 3 4
* ATtinyX5 0 4 3
* ATtin167 9 8 5 // Digispark pro number schema
* ATtin167 3 2 7
* ATtin3217 10 11 3 // TinyCore schema
* SAMD21 3 4 5
* ESP8266 14 // D5 12 // D6 %
* ESP32 15 4 %
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
*/
//#define IRMP_MEASURE_TIMING // For debugging purposes.
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
// Timer 3 of IRMP 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
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
//#include "ATtinySerialOut.h"
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
# if defined(ARDUINO_AVR_DIGISPARK)
#define LED_BUILTIN PB1
# endif
#define IR_RECEIVE_PIN 0
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
#define TONE_PIN 3
//#define IR_TIMING_TEST_PIN 3
# else
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.
# if defined(ARDUINO_AVR_DIGISPARKPRO)
#define LED_BUILTIN 1 // PB1 - on Digispark board labeled as pin 1 / for ATtinyCore lib use D9
#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
#define IR_TIMING_TEST_PIN 10 // PA4
# else
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 2
#define TONE_PIN 7
# endif
# endif
#elif defined(__AVR_ATtiny3217__)
#define IR_RECEIVE_PIN 10
#define IR_SEND_PIN 11
#define TONE_PIN 3
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#elif defined(TEENSYDUINO)
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#elif defined(__AVR__)
#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 IR_TIMING_TEST_PIN 6
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
#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 IR_TIMING_TEST_PIN 6
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
// Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13/PA17.
// Attention!!! D2 and D4 are switched 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
#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 IR_TIMING_TEST_PIN 6
#endif // defined(ESP8266)
/*
* Helper macro for getting a macro definition as string
*/
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

View File

@ -1,159 +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 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
*
* This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* IRMP 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
* -----------------------------------------
* DEFAULT/AVR 2 3 4
* ATtinyX5 0 4 3
* ATtin167 9 8 5 // Digispark pro number schema
* ATtin167 3 2 7
* ATtin3217 10 11 3 // TinyCore schema
* SAMD21 3 4 5
* ESP8266 14 // D5 12 // D6 %
* ESP32 15 4 %
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
*/
//#define IRMP_MEASURE_TIMING // For debugging purposes.
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
// Timer 3 of IRMP 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
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
//#include "ATtinySerialOut.h"
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
# if defined(ARDUINO_AVR_DIGISPARK)
#define LED_BUILTIN PB1
# endif
#define IR_RECEIVE_PIN 0
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
#define TONE_PIN 3
//#define IR_TIMING_TEST_PIN 3
# else
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.
# if defined(ARDUINO_AVR_DIGISPARKPRO)
#define LED_BUILTIN 1 // PB1 - on Digispark board labeled as pin 1 / for ATtinyCore lib use D9
#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
#define IR_TIMING_TEST_PIN 10 // PA4
# else
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 2
#define TONE_PIN 7
# endif
# endif
#elif defined(__AVR_ATtiny3217__)
#define IR_RECEIVE_PIN 10
#define IR_SEND_PIN 11
#define TONE_PIN 3
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#elif defined(TEENSYDUINO)
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#elif defined(__AVR__)
#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 IR_TIMING_TEST_PIN 6
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
#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 IR_TIMING_TEST_PIN 6
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
// Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13/PA17.
// Attention!!! D2 and D4 are switched 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
#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 IR_TIMING_TEST_PIN 6
#endif // defined(ESP8266)
/*
* Helper macro for getting a macro definition as string
*/
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

View File

@ -9,7 +9,7 @@
*
* This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* IRMP is free software: you can redistribute it and/or modify
* 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.
@ -44,19 +44,19 @@
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
@ -101,34 +101,58 @@
#define IR_SEND_PIN 11
#define TONE_PIN 3
# 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
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(TEENSYDUINO)
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(__AVR__)
#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 IR_TIMING_TEST_PIN 6
#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
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
#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 IR_TIMING_TEST_PIN 6
#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
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
@ -146,10 +170,12 @@
#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 IR_TIMING_TEST_PIN 6
#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)
/*

View File

@ -2,8 +2,8 @@
* ReceiveAndSend.cpp
*
* Record and play back IR signals as a minimal
* An IR detector/demodulator must be connected to the input RECV_PIN.
* An IR LED must be connected to the output PWM pin 3.
* An IR detector/demodulator must be connected to the input IR_RECEIVE_PIN.
* A button must be connected between the input SEND_BUTTON_PIN and ground.
* A visible LED can be connected to STATUS_PIN to provide status.
*
@ -18,7 +18,7 @@
************************************************************************************
* MIT License
*
* Copyright (c) 2020-2021 Armin Joachimsmeyer
* Copyright (c) 2009-2021 Ken Shirriff, 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
@ -87,23 +87,18 @@ void setup() {
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); // Start the receiver, enable feedback LED, take LED feedback pin from the internal boards definition
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin
pinMode(SEND_BUTTON_PIN, INPUT_PULLUP);
pinMode(STATUS_PIN, OUTPUT);
Serial.print(F("Ready to receive IR signals at pin "));
Serial.println(IR_RECEIVE_PIN);
#if defined(SENDING_SUPPORTED)
Serial.print(F("Ready to send IR signals at pin "));
Serial.print(IR_SEND_PIN);
Serial.print(F(" on press of button at pin "));
Serial.println(SEND_BUTTON_PIN);
#else
Serial.println(F("Sending not supported for this board!"));
#endif
}
void loop() {

View File

@ -0,0 +1,151 @@
START ../src/ReceiveDemo.cpp from Mar 8 2021
Using library version 3.1.0
Enabling IRin...
Ready to receive IR signals at pin 2
20 us are subtracted from all marks and added to all spaces for decoding
Protocol=NEC Address=0x2 Command=0x34 Raw-Data=0xCB34FD02 32 bits LSB first
Protocol=NEC Address=0x102 Command=0x34 Raw-Data=0xCB340102 32 bits LSB first
Protocol=NEC Address=0x80 Command=0x45 Raw-Data=0xBA457F80 32 bits LSB first
Protocol=NEC Address=0x102 Command=0x34 Parity fail Raw-Data=0xC0340102 32 bits LSB first
Protocol=NEC Address=0x102 Command=0x34 Raw-Data=0xCB340102 32 bits LSB first
Protocol=APPLE Address=0x2 Command=0x34 Raw-Data=0x23487EE 32 bits LSB first
Protocol=PANASONIC Address=0x102 Command=0x34 Raw-Data=0x4341020 48 bits LSB first
Protocol=KASEIKYO Address=0x102 Command=0x34 Extra=0x4711 Raw-Data=0x7341023 48 bits LSB first
Protocol=DENON Address=0x2 Command=0x34 Raw-Data=0x8D0 15 bits MSB first
Protocol=DENON Address=0x2 Command=0x34 Auto-Repeat gap=44550us Raw-Data=0xB2F 15 bits MSB first
Protocol=SHARP Address=0x2 Command=0x34 Raw-Data=0x8D2 15 bits MSB first
Protocol=SHARP Address=0x2 Command=0x34 Auto-Repeat gap=44600us Raw-Data=0xB2D 15 bits MSB first
Protocol=SONY Address=0x2 Command=0x34 Raw-Data=0x134 12 bits LSB first
Protocol=SONY Address=0x2 Command=0x34 Raw-Data=0x134 15 bits LSB first
Protocol=SONY Address=0x0 Command=0x0 Raw-Data=0x0 0 bits LSB first
Protocol=SONY Address=0x102 Command=0x34 Raw-Data=0x8134 20 bits LSB first
Protocol=RC5 Address=0x2 Command=0x34 Toggle=1 Raw-Data=0x38B4 13 bits MSB first
Protocol=RC5 Address=0x2 Command=0x74 Raw-Data=0x20B4 13 bits MSB first
Protocol=RC6 Address=0x2 Command=0x34 Raw-Data=0x234 16 bits MSB first
Protocol=SAMSUNG Address=0x102 Command=0x34 Raw-Data=0xCB340102 32 bits LSB first
Protocol=JVC Address=0x2 Command=0x34 Raw-Data=0x3402 16 bits LSB first
Protocol=LG Address=0x2 Command=0x34 Raw-Data=0x200347 28 bits MSB first
Protocol=BOSEWAVE Address=0x0 Command=0x34 Raw-Data=0xCB34 16 bits LSB first
Protocol=LEGO_PF Address=0x3 Command=0x14 Raw-Data=0x2148 16 bits MSB first
Protocol=LEGO_PF Address=0x3 Command=0x14 Auto-Repeat gap=216800us Raw-Data=0x2148 16 bits MSB first
Protocol=LEGO_PF Address=0x2 Command=0x14 Auto-Repeat gap=177200us Raw-Data=0x2148 16 bits MSB first
Protocol=LEGO_PF Address=0x2 Command=0x14 Auto-Repeat gap=177200us Raw-Data=0x2148 16 bits MSB first
Protocol=LEGO_PF Address=0x2 Command=0x14 Auto-Repeat gap=177200us Raw-Data=0x2148 16 bits MSB first
Overflow detected
Protocol=NEC Address=0x3 Command=0x45 Raw-Data=0xBA45FC03 32 bits LSB first
Protocol=NEC Address=0x3 Command=0x45 Repeat gap=47550us
Protocol=NEC Address=0x203 Command=0x45 Raw-Data=0xBA450203 32 bits LSB first
Protocol=NEC Address=0x203 Command=0x45 Repeat gap=47550us
Protocol=APPLE Address=0x3 Command=0x45 Raw-Data=0x34587EE 32 bits LSB first
Protocol=APPLE Address=0x3 Command=0x45 Repeat gap=47550us
Protocol=PANASONIC Address=0x203 Command=0x45 Raw-Data=0x55452030 48 bits LSB first
Protocol=PANASONIC Address=0x203 Command=0x45 Repeat gap=73250us Raw-Data=0x55452030 48 bits LSB first
Protocol=KASEIKYO Address=0x203 Command=0x45 Extra=0x4711 Raw-Data=0x56452033 48 bits LSB first
Protocol=KASEIKYO Address=0x203 Command=0x45 Extra=0x4711 Repeat gap=73250us Raw-Data=0x56452033 48 bits LSB first
Protocol=DENON Address=0x3 Command=0x45 Raw-Data=0xD14 15 bits MSB first
Protocol=DENON Address=0x3 Command=0x45 Auto-Repeat gap=44550us Raw-Data=0xEEB 15 bits MSB first
Protocol=DENON Address=0x3 Command=0x45 Repeat gap=44550us Raw-Data=0xD14 15 bits MSB first
Protocol=DENON Address=0x3 Command=0x45 Auto-Repeat gap=44550us Raw-Data=0xEEB 15 bits MSB first
Protocol=SHARP Address=0x3 Command=0x45 Raw-Data=0xD16 15 bits MSB first
Protocol=SHARP Address=0x3 Command=0x45 Auto-Repeat gap=44550us Raw-Data=0xEE9 15 bits MSB first
Protocol=SHARP Address=0x3 Command=0x45 Repeat gap=44550us Raw-Data=0xD16 15 bits MSB first
Protocol=SHARP Address=0x3 Command=0x45 Auto-Repeat gap=44550us Raw-Data=0xEE9 15 bits MSB first
Protocol=SONY Address=0x3 Command=0x45 Raw-Data=0x1C5 12 bits LSB first
Protocol=SONY Address=0x3 Command=0x45 Repeat gap=24350us Raw-Data=0x1C5 12 bits LSB first
Protocol=SONY Address=0x3 Command=0x45 Raw-Data=0x1C5 15 bits LSB first
Protocol=SONY Address=0x3 Command=0x45 Repeat gap=24350us Raw-Data=0x1C5 15 bits LSB first
Protocol=SONY Address=0x203 Command=0x45 Raw-Data=0x101C5 20 bits LSB first
Protocol=SONY Address=0x203 Command=0x45 Repeat gap=24300us Raw-Data=0x101C5 20 bits LSB first
Protocol=RC5 Address=0x3 Command=0x5 Raw-Data=0x30C5 13 bits MSB first
Protocol=RC5 Address=0x3 Command=0x5 Repeat gap=99000us Raw-Data=0x30C5 13 bits MSB first
Protocol=RC5 Address=0x3 Command=0x45 Toggle=1 Raw-Data=0x28C5 13 bits MSB first
Protocol=RC5 Address=0x3 Command=0x45 Toggle=1 Repeat gap=98950us Raw-Data=0x28C5 13 bits MSB first
Protocol=RC6 Address=0x3 Command=0x45 Raw-Data=0x345 16 bits MSB first
Protocol=RC6 Address=0x3 Command=0x45 Repeat gap=106400us Raw-Data=0x345 16 bits MSB first
Protocol=SAMSUNG Address=0x203 Command=0x45 Raw-Data=0xBA450203 32 bits LSB first
Protocol=SAMSUNG Address=0x203 Command=0x45 Repeat gap=54500us
Protocol=JVC Address=0x3 Command=0x45 Raw-Data=0x4503 16 bits LSB first
Protocol=JVC Address=0x3 Command=0x45 Repeat gap=22750us
Protocol=LG Address=0x3 Command=0x45 Raw-Data=0x300459 28 bits MSB first
Protocol=LG Address=0x3 Command=0x45 Repeat gap=51500us
Protocol=BOSEWAVE Address=0x0 Command=0x45 Raw-Data=0xBA45 16 bits LSB first
Protocol=BOSEWAVE Address=0x0 Command=0x45 Repeat gap=51450us Raw-Data=0xBA45 16 bits LSB first
Protocol=LEGO_PF Address=0x3 Command=0x15 Raw-Data=0x3158 16 bits MSB first
Protocol=LEGO_PF Address=0x3 Command=0x15 Auto-Repeat gap=216800us Raw-Data=0x3158 16 bits MSB first
Protocol=LEGO_PF Address=0x3 Command=0x15 Auto-Repeat gap=216800us Raw-Data=0x3158 16 bits MSB first
Protocol=LEGO_PF Address=0x3 Command=0x15 Auto-Repeat gap=216800us Raw-Data=0x3158 16 bits MSB first
Protocol=LEGO_PF Address=0x3 Command=0x15 Auto-Repeat gap=216800us Raw-Data=0x3158 16 bits MSB first
Overflow detected

View File

@ -9,7 +9,7 @@
*
* This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* IRMP is free software: you can redistribute it and/or modify
* 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.
@ -44,19 +44,19 @@
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
@ -101,34 +101,58 @@
#define IR_SEND_PIN 11
#define TONE_PIN 3
# 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
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(TEENSYDUINO)
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(__AVR__)
#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 IR_TIMING_TEST_PIN 6
#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
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
#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 IR_TIMING_TEST_PIN 6
#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
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
@ -146,10 +170,12 @@
#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 IR_TIMING_TEST_PIN 6
#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)
/*

View File

@ -1,7 +1,7 @@
/*
* IRreceiveDemo.cpp
* ReceiveDemo.cpp
*
* Demonstrates receiving IR codes with IRrecv
* Demonstrates receiving IR codes with the IRremote library.
*
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
*
@ -39,6 +39,9 @@
//#define DECODE_LG 1
//#define DECODE_NEC 1
// etc. see IRremote.h
//#define DISABLE_LED_FEEDBACK_FOR_RECEIVE // saves 108 bytes program space
#if defined(__AVR_ATtiny85__)
#define EXCLUDE_EXOTIC_PROTOCOLS
#endif
@ -55,8 +58,11 @@
#include <IRremote.h>
#define BUZZER_PIN 5
#define DEBUG_BUTTON_PIN 6 // if held low, print timing for each received data
#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
// On the Zero and others we switch explicitly to SerialUSB
#if defined(ARDUINO_ARCH_SAMD)
@ -77,7 +83,7 @@ void setup() {
// In case the interrupt driver crashes on setup, give a clue
// to the user what's going on.
Serial.println(F("Enabling IRin"));
Serial.println(F("Enabling IRin..."));
/*
* Start the receiver, enable feedback LED and (if not 3. parameter specified) take LED feedback pin from the internal boards definition
@ -86,6 +92,10 @@ void setup() {
Serial.print(F("Ready to receive IR signals at pin "));
Serial.println(IR_RECEIVE_PIN);
// infos for receive
Serial.print(MARK_EXCESS_MICROS);
Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding"));
}
void loop() {
@ -98,7 +108,7 @@ void loop() {
* and up to 32 bit raw data in IrReceiver.decodedIRData.decodedRawData
*/
if (IrReceiver.decode()) {
#if defined(__AVR_ATtiny85__)
#if FLASHEND <= 0x1FFF // For less equal than 8k flash, like ATtiny85
// Print a minimal summary of received data
IrReceiver.printIRResultMinimal(&Serial);
#else
@ -133,7 +143,7 @@ void loop() {
delay(8);
IrReceiver.start(8000); // to compensate for 11 ms stop of receiver. This enables a correct gap measurement.
# endif
#endif // defined(__AVR_ATtiny85__)
#endif // FLASHEND > 0x1FFF
Serial.println();
/*

View File

@ -9,7 +9,7 @@
*
* This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* IRMP is free software: you can redistribute it and/or modify
* 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.
@ -44,19 +44,19 @@
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
@ -101,34 +101,58 @@
#define IR_SEND_PIN 11
#define TONE_PIN 3
# 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
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(TEENSYDUINO)
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(__AVR__)
#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 IR_TIMING_TEST_PIN 6
#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
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
#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 IR_TIMING_TEST_PIN 6
#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
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
@ -146,10 +170,12 @@
#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 IR_TIMING_TEST_PIN 6
#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)
/*

View File

@ -1,5 +1,5 @@
/*
* IRreceiveDump.cpp
* ReceiveDump.cpp
*
* Dumps the received signal in different flavors.
* Since the printing takes so much time, repeat signals may be skipped or interpreted as UNKNOWN.

View File

@ -9,7 +9,7 @@
*
* This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* IRMP is free software: you can redistribute it and/or modify
* 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.
@ -44,19 +44,19 @@
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
@ -101,34 +101,58 @@
#define IR_SEND_PIN 11
#define TONE_PIN 3
# 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
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(TEENSYDUINO)
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(__AVR__)
#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 IR_TIMING_TEST_PIN 6
#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
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
#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 IR_TIMING_TEST_PIN 6
#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
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
@ -146,10 +170,12 @@
#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 IR_TIMING_TEST_PIN 6
#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)
/*

View File

@ -1,5 +1,5 @@
/*
* BoseWaveSendDemo.cpp
* SendBoseWaveDemo.cpp
*
* Prompt user for a code to send. Make sure your 940-950nm IR LED is
* connected to the default digital output. Place your Bose Wave Radio
@ -88,7 +88,10 @@ void setup() {
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin
Serial.print(F("Ready to send IR signals at pin "));
Serial.println(IR_SEND_PIN);
prompt = true;
}

View File

@ -0,0 +1,151 @@
START ../src/ReceiveDemo.cpp from Mar 8 2021
Using library version 3.1.0
Enabling IRin...
Ready to receive IR signals at pin 2
20 us are subtracted from all marks and added to all spaces for decoding
Protocol=NEC Address=0x2 Command=0x34 Raw-Data=0xCB34FD02 32 bits LSB first
Protocol=NEC Address=0x102 Command=0x34 Raw-Data=0xCB340102 32 bits LSB first
Protocol=NEC Address=0x80 Command=0x45 Raw-Data=0xBA457F80 32 bits LSB first
Protocol=NEC Address=0x102 Command=0x34 Parity fail Raw-Data=0xC0340102 32 bits LSB first
Protocol=NEC Address=0x102 Command=0x34 Raw-Data=0xCB340102 32 bits LSB first
Protocol=APPLE Address=0x2 Command=0x34 Raw-Data=0x23487EE 32 bits LSB first
Protocol=PANASONIC Address=0x102 Command=0x34 Raw-Data=0x4341020 48 bits LSB first
Protocol=KASEIKYO Address=0x102 Command=0x34 Extra=0x4711 Raw-Data=0x7341023 48 bits LSB first
Protocol=DENON Address=0x2 Command=0x34 Raw-Data=0x8D0 15 bits MSB first
Protocol=DENON Address=0x2 Command=0x34 Auto-Repeat gap=44550us Raw-Data=0xB2F 15 bits MSB first
Protocol=SHARP Address=0x2 Command=0x34 Raw-Data=0x8D2 15 bits MSB first
Protocol=SHARP Address=0x2 Command=0x34 Auto-Repeat gap=44600us Raw-Data=0xB2D 15 bits MSB first
Protocol=SONY Address=0x2 Command=0x34 Raw-Data=0x134 12 bits LSB first
Protocol=SONY Address=0x2 Command=0x34 Raw-Data=0x134 15 bits LSB first
Protocol=SONY Address=0x0 Command=0x0 Raw-Data=0x0 0 bits LSB first
Protocol=SONY Address=0x102 Command=0x34 Raw-Data=0x8134 20 bits LSB first
Protocol=RC5 Address=0x2 Command=0x34 Toggle=1 Raw-Data=0x38B4 13 bits MSB first
Protocol=RC5 Address=0x2 Command=0x74 Raw-Data=0x20B4 13 bits MSB first
Protocol=RC6 Address=0x2 Command=0x34 Raw-Data=0x234 16 bits MSB first
Protocol=SAMSUNG Address=0x102 Command=0x34 Raw-Data=0xCB340102 32 bits LSB first
Protocol=JVC Address=0x2 Command=0x34 Raw-Data=0x3402 16 bits LSB first
Protocol=LG Address=0x2 Command=0x34 Raw-Data=0x200347 28 bits MSB first
Protocol=BOSEWAVE Address=0x0 Command=0x34 Raw-Data=0xCB34 16 bits LSB first
Protocol=LEGO_PF Address=0x3 Command=0x14 Raw-Data=0x2148 16 bits MSB first
Protocol=LEGO_PF Address=0x3 Command=0x14 Auto-Repeat gap=216800us Raw-Data=0x2148 16 bits MSB first
Protocol=LEGO_PF Address=0x2 Command=0x14 Auto-Repeat gap=177200us Raw-Data=0x2148 16 bits MSB first
Protocol=LEGO_PF Address=0x2 Command=0x14 Auto-Repeat gap=177200us Raw-Data=0x2148 16 bits MSB first
Protocol=LEGO_PF Address=0x2 Command=0x14 Auto-Repeat gap=177200us Raw-Data=0x2148 16 bits MSB first
Overflow detected
Protocol=NEC Address=0x3 Command=0x45 Raw-Data=0xBA45FC03 32 bits LSB first
Protocol=NEC Address=0x3 Command=0x45 Repeat gap=47550us
Protocol=NEC Address=0x203 Command=0x45 Raw-Data=0xBA450203 32 bits LSB first
Protocol=NEC Address=0x203 Command=0x45 Repeat gap=47550us
Protocol=APPLE Address=0x3 Command=0x45 Raw-Data=0x34587EE 32 bits LSB first
Protocol=APPLE Address=0x3 Command=0x45 Repeat gap=47550us
Protocol=PANASONIC Address=0x203 Command=0x45 Raw-Data=0x55452030 48 bits LSB first
Protocol=PANASONIC Address=0x203 Command=0x45 Repeat gap=73250us Raw-Data=0x55452030 48 bits LSB first
Protocol=KASEIKYO Address=0x203 Command=0x45 Extra=0x4711 Raw-Data=0x56452033 48 bits LSB first
Protocol=KASEIKYO Address=0x203 Command=0x45 Extra=0x4711 Repeat gap=73250us Raw-Data=0x56452033 48 bits LSB first
Protocol=DENON Address=0x3 Command=0x45 Raw-Data=0xD14 15 bits MSB first
Protocol=DENON Address=0x3 Command=0x45 Auto-Repeat gap=44550us Raw-Data=0xEEB 15 bits MSB first
Protocol=DENON Address=0x3 Command=0x45 Repeat gap=44550us Raw-Data=0xD14 15 bits MSB first
Protocol=DENON Address=0x3 Command=0x45 Auto-Repeat gap=44550us Raw-Data=0xEEB 15 bits MSB first
Protocol=SHARP Address=0x3 Command=0x45 Raw-Data=0xD16 15 bits MSB first
Protocol=SHARP Address=0x3 Command=0x45 Auto-Repeat gap=44550us Raw-Data=0xEE9 15 bits MSB first
Protocol=SHARP Address=0x3 Command=0x45 Repeat gap=44550us Raw-Data=0xD16 15 bits MSB first
Protocol=SHARP Address=0x3 Command=0x45 Auto-Repeat gap=44550us Raw-Data=0xEE9 15 bits MSB first
Protocol=SONY Address=0x3 Command=0x45 Raw-Data=0x1C5 12 bits LSB first
Protocol=SONY Address=0x3 Command=0x45 Repeat gap=24350us Raw-Data=0x1C5 12 bits LSB first
Protocol=SONY Address=0x3 Command=0x45 Raw-Data=0x1C5 15 bits LSB first
Protocol=SONY Address=0x3 Command=0x45 Repeat gap=24350us Raw-Data=0x1C5 15 bits LSB first
Protocol=SONY Address=0x203 Command=0x45 Raw-Data=0x101C5 20 bits LSB first
Protocol=SONY Address=0x203 Command=0x45 Repeat gap=24300us Raw-Data=0x101C5 20 bits LSB first
Protocol=RC5 Address=0x3 Command=0x5 Raw-Data=0x30C5 13 bits MSB first
Protocol=RC5 Address=0x3 Command=0x5 Repeat gap=99000us Raw-Data=0x30C5 13 bits MSB first
Protocol=RC5 Address=0x3 Command=0x45 Toggle=1 Raw-Data=0x28C5 13 bits MSB first
Protocol=RC5 Address=0x3 Command=0x45 Toggle=1 Repeat gap=98950us Raw-Data=0x28C5 13 bits MSB first
Protocol=RC6 Address=0x3 Command=0x45 Raw-Data=0x345 16 bits MSB first
Protocol=RC6 Address=0x3 Command=0x45 Repeat gap=106400us Raw-Data=0x345 16 bits MSB first
Protocol=SAMSUNG Address=0x203 Command=0x45 Raw-Data=0xBA450203 32 bits LSB first
Protocol=SAMSUNG Address=0x203 Command=0x45 Repeat gap=54500us
Protocol=JVC Address=0x3 Command=0x45 Raw-Data=0x4503 16 bits LSB first
Protocol=JVC Address=0x3 Command=0x45 Repeat gap=22750us
Protocol=LG Address=0x3 Command=0x45 Raw-Data=0x300459 28 bits MSB first
Protocol=LG Address=0x3 Command=0x45 Repeat gap=51500us
Protocol=BOSEWAVE Address=0x0 Command=0x45 Raw-Data=0xBA45 16 bits LSB first
Protocol=BOSEWAVE Address=0x0 Command=0x45 Repeat gap=51450us Raw-Data=0xBA45 16 bits LSB first
Protocol=LEGO_PF Address=0x3 Command=0x15 Raw-Data=0x3158 16 bits MSB first
Protocol=LEGO_PF Address=0x3 Command=0x15 Auto-Repeat gap=216800us Raw-Data=0x3158 16 bits MSB first
Protocol=LEGO_PF Address=0x3 Command=0x15 Auto-Repeat gap=216800us Raw-Data=0x3158 16 bits MSB first
Protocol=LEGO_PF Address=0x3 Command=0x15 Auto-Repeat gap=216800us Raw-Data=0x3158 16 bits MSB first
Protocol=LEGO_PF Address=0x3 Command=0x15 Auto-Repeat gap=216800us Raw-Data=0x3158 16 bits MSB first
Overflow detected

View File

@ -0,0 +1,185 @@
/*
* 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 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
*
* This file is part of IRMP 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
* -----------------------------------------
* DEFAULT/AVR 2 3 4
* ATtinyX5 0 4 3
* ATtin167 9 8 5 // Digispark pro number schema
* ATtin167 3 2 7
* ATtin3217 10 11 3 // TinyCore schema
* SAMD21 3 4 5
* ESP8266 14 // D5 12 // D6 %
* ESP32 15 4 %
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
*/
//#define IRMP_MEASURE_TIMING // For debugging purposes.
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
// Timer 3 of IRMP 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
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
//#include "ATtinySerialOut.h"
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
# if defined(ARDUINO_AVR_DIGISPARK)
#define LED_BUILTIN PB1
# endif
#define IR_RECEIVE_PIN 0
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
#define TONE_PIN 3
//#define IR_TIMING_TEST_PIN 3
# else
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.
# if defined(ARDUINO_AVR_DIGISPARKPRO)
#define LED_BUILTIN 1 // PB1 - on Digispark board labeled as pin 1 / for ATtinyCore lib use D9
#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
#define IR_TIMING_TEST_PIN 10 // PA4
# else
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 2
#define TONE_PIN 7
# endif
# endif
#elif defined(__AVR_ATtiny3217__)
#define IR_RECEIVE_PIN 10
#define IR_SEND_PIN 11
#define TONE_PIN 3
# 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
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#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(TEENSYDUINO)
#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(__AVR__)
#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
#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
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
// Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13/PA17.
// Attention!!! D2 and D4 are switched 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
#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)
/*
* Helper macro for getting a macro definition as string
*/
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

View File

@ -1,10 +1,8 @@
/*
* IRsendDemo.cpp
* SendDemo.cpp
*
* Demonstrates sending IR codes in standard format with address and command
*
* An IR LED must be connected to Arduino PWM pin 3 (IR_SEND_PIN).
*
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
*
************************************************************************************
@ -44,6 +42,9 @@
#include <IRremote.h>
#define DELAY_AFTER_SEND 2000
#define DELAY_AFTER_LOOP 5000
void setup() {
Serial.begin(115200);
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL) || defined(ARDUINO_attiny3217)
@ -51,19 +52,23 @@ void setup() {
#endif
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin
Serial.print(F("Ready to send IR signals at pin "));
Serial.println(IR_SEND_PIN);
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
#if defined(USE_SOFT_SEND_PWM) && !defined(ESP32) // for esp32 we use PWM generation by hw_timer_t for each pin
#if defined(USE_SOFT_SEND_PWM) && !defined(ESP32) // for esp32 we use PWM generation by hw_timer_t for each pin
/*
* Print internal signal generation info
*/
IrSender.enableIROut(38);
Serial.print(F("Send signal mark duration is "));
Serial.print(IrSender.periodOnTimeMicros);
Serial.print(F(" us from a total period of "));
Serial.print(F(" us, pulse correction is "));
Serial.print((uint16_t) PULSE_CORRECTION_NANOS);
Serial.print(F(" ns, total period is "));
Serial.print(IrSender.periodTimeMicros);
Serial.println(F(" us"));
#endif
@ -89,20 +94,21 @@ void loop() {
Serial.print(F(" command=0x"));
Serial.print(sCommand, HEX);
Serial.print(F(" repeats="));
Serial.print(sRepeats);
Serial.println(sRepeats);
Serial.println();
Serial.println();
Serial.flush();
Serial.println(F("Send NEC with 8 bit address"));
IrSender.sendNEC(sAddress & 0xFF, sCommand, sRepeats);
delay(2000); // delay must be greater than 5 ms (RECORD_GAP_MICROS), otherwise the receiver sees it as one long signal
delay(DELAY_AFTER_SEND); // delay must be greater than 5 ms (RECORD_GAP_MICROS), otherwise the receiver sees it as one long signal
Serial.println(F("Send NEC with 16 bit address"));
IrSender.sendNEC(sAddress, sCommand, sRepeats);
delay(2000);
delay(DELAY_AFTER_SEND);
if (sRepeats == 0) {
#if !defined(__AVR_ATtiny85__)
#if FLASHEND > 0x1FFF // For more than 8k flash. Code does not fit in program space of ATtiny85
/*
* Send constant values only once in this demo
*/
@ -113,7 +119,7 @@ void loop() {
"0017 003E 0017 0015 0017 003F 0017 0015 0017 0015 0017 0015 0017 003F 0017 0015 " /* command byte */
"0019 0013 0019 003C 0017 0015 0017 003F 0017 003E 0017 003F 0017 0015 0017 003E " /* inverted command byte */
"0017 0806"), 0); //stop bit, no repeat possible, because of missing repeat pattern
delay(2000);
delay(DELAY_AFTER_SEND);
#endif
/*
* With sendNECRaw() you can send even "forbidden" codes with parity errors
@ -122,7 +128,7 @@ void loop() {
F(
"Send NEC with 16 bit address 0x0102 and command 0x34 with NECRaw(0xCC340102) which results in a parity error, since 34 == ~CB and not C0"));
IrSender.sendNECRaw(0xC0340102, sRepeats);
delay(2000);
delay(DELAY_AFTER_SEND);
/*
* With Send sendNECMSB() you can send your old 32 bit codes.
@ -132,54 +138,54 @@ void loop() {
*/
Serial.println(F("Send NEC with 16 bit address 0x0102 and command 0x34 with old 32 bit format MSB first"));
IrSender.sendNECMSB(0x40802CD3, 32, false);
delay(2000);
delay(DELAY_AFTER_SEND);
}
Serial.println(F("Send Apple"));
IrSender.sendApple(sAddress, sCommand, sRepeats);
delay(2000);
IrSender.sendApple(sAddress & 0xFF, sCommand, sRepeats);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Panasonic"));
IrSender.sendPanasonic(sAddress, sCommand, sRepeats);
delay(2000);
IrSender.sendPanasonic(sAddress & 0xFFF, sCommand, sRepeats);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Kaseikyo with 0x4711 as Vendor ID"));
IrSender.sendKaseikyo(sAddress, sCommand, sRepeats, 0x4711);
delay(2000);
IrSender.sendKaseikyo(sAddress & 0xFFF, sCommand, sRepeats, 0x4711);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Denon"));
IrSender.sendDenon(sAddress, sCommand, sRepeats);
delay(2000);
IrSender.sendDenon(sAddress & 0x1F, sCommand, sRepeats);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Denon/Sharp variant"));
IrSender.sendSharp(sAddress, sCommand, sRepeats);
delay(2000);
IrSender.sendSharp(sAddress & 0x1F, sCommand, sRepeats);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Sony/SIRCS with 7 command and 5 address bits"));
IrSender.sendSony(sAddress, sCommand, sRepeats);
delay(2000);
IrSender.sendSony(sAddress & 0x1F, sCommand & 0x7F, sRepeats);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Sony/SIRCS with 7 command and 8 address bits"));
IrSender.sendSony(sAddress, sCommand, sRepeats, SIRCS_15_PROTOCOL);
delay(2000);
IrSender.sendSony(sAddress & 0xFF, sCommand, sRepeats, SIRCS_15_PROTOCOL);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Sony/SIRCS with 7 command and 13 address bits"));
IrSender.sendSony(sAddress, sCommand, sRepeats, SIRCS_20_PROTOCOL);
delay(2000);
IrSender.sendSony(sAddress & 0x1FFF, sCommand & 0x7F, sRepeats, SIRCS_20_PROTOCOL);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send RC5"));
IrSender.sendRC5(sAddress, sCommand, sRepeats, true);
delay(2000);
IrSender.sendRC5(sAddress & 0x1F, sCommand & 0x3F, sRepeats, true); // 5 address, 6 command bits
delay(DELAY_AFTER_SEND);
Serial.println(F("Send RC5X with command + 0x40"));
IrSender.sendRC5(sAddress, sCommand + 0x40, sRepeats, true);
delay(2000);
Serial.println(F("Send RC5X with 7.th MSB of command set"));
IrSender.sendRC5(sAddress & 0x1F, (sCommand & 0x3F) + 0x40, sRepeats, true); // 5 address, 7 command bits
delay(DELAY_AFTER_SEND);
Serial.println(F("Send RC6"));
IrSender.sendRC6(sAddress, sCommand, sRepeats, true);
delay(2000);
delay(DELAY_AFTER_SEND);
#if !defined(__AVR_ATtiny85__) // code does not fit in program space of ATtiny85
#if FLASHEND > 0x1FFF // For more than 8k flash. Code does not fit in program space of ATtiny85
/*
* Next example how to use the IrSender.write function
*/
@ -193,43 +199,31 @@ void loop() {
Serial.print(F("Send "));
Serial.println(getProtocolString(IRSendData.protocol));
IrSender.write(&IRSendData, sRepeats);
delay(2000);
delay(DELAY_AFTER_SEND);
IRSendData.protocol = JVC; // switch protocol
Serial.print(F("Send "));
Serial.println(getProtocolString(IRSendData.protocol));
IrSender.write(&IRSendData, sRepeats);
delay(2000);
delay(DELAY_AFTER_SEND);
IRSendData.protocol = LG;
Serial.print(F("Send "));
Serial.println(getProtocolString(IRSendData.protocol));
IrSender.write(&IRSendData, sRepeats);
delay(2000);
if (sRepeats == 0) {
/*
* Send constant values only once in this demo
* This value is the valid LG turn off command which violates the parity rule
* All other commands obey this rule.
* see: https://github.com/Arduino-IRremote/Arduino-IRremote/tree/master/examples/LGACSendDemo
*/
Serial.println(F("Send LGRaw 0x88C0051 with \"parity error\" since C+0+0+5 != 1"));
IrSender.sendLGRaw(0x88C0051, sRepeats);
delay(2000);
}
delay(DELAY_AFTER_SEND);
IRSendData.protocol = BOSEWAVE;
Serial.println(F("Send Bosewave with no address and 8 command bits"));
IrSender.write(&IRSendData, sRepeats);
delay(2000);
delay(DELAY_AFTER_SEND);
/*
* LEGO is difficult to receive because of its short marks and spaces
*/
Serial.println(F("Send Lego with 2 channel and with 4 command bits"));
IrSender.sendLegoPowerFunctions(sAddress, sCommand, LEGO_MODE_COMBO, true);
delay(2000);
delay(DELAY_AFTER_SEND);
/*
* Force buffer overflow
@ -239,7 +233,7 @@ void loop() {
IrSender.mark(400);
IrSender.space(400);
}
delay(2000);
delay(DELAY_AFTER_SEND);
/*
* Increment values
@ -252,7 +246,7 @@ void loop() {
if (sRepeats > 4) {
sRepeats = 4;
}
#endif // !defined(__AVR_ATtiny85__)
#endif // FLASHEND > 0x1FFF
delay(4000); // additional delay at the end of each loop
delay(DELAY_AFTER_LOOP); // additional delay at the end of each loop
}

View File

@ -0,0 +1,185 @@
/*
* 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 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
*
* This file is part of IRMP 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
* -----------------------------------------
* DEFAULT/AVR 2 3 4
* ATtinyX5 0 4 3
* ATtin167 9 8 5 // Digispark pro number schema
* ATtin167 3 2 7
* ATtin3217 10 11 3 // TinyCore schema
* SAMD21 3 4 5
* ESP8266 14 // D5 12 // D6 %
* ESP32 15 4 %
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
*/
//#define IRMP_MEASURE_TIMING // For debugging purposes.
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
// Timer 3 of IRMP 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
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
//#include "ATtinySerialOut.h"
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
# if defined(ARDUINO_AVR_DIGISPARK)
#define LED_BUILTIN PB1
# endif
#define IR_RECEIVE_PIN 0
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
#define TONE_PIN 3
//#define IR_TIMING_TEST_PIN 3
# else
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.
# if defined(ARDUINO_AVR_DIGISPARKPRO)
#define LED_BUILTIN 1 // PB1 - on Digispark board labeled as pin 1 / for ATtinyCore lib use D9
#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
#define IR_TIMING_TEST_PIN 10 // PA4
# else
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 2
#define TONE_PIN 7
# endif
# endif
#elif defined(__AVR_ATtiny3217__)
#define IR_RECEIVE_PIN 10
#define IR_SEND_PIN 11
#define TONE_PIN 3
# 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
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#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(TEENSYDUINO)
#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(__AVR__)
#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
#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
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
// Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13/PA17.
// Attention!!! D2 and D4 are switched 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
#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)
/*
* Helper macro for getting a macro definition as string
*/
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

View File

@ -1,12 +1,9 @@
/*
* LGAirConditionerSendDemo.cpp
* SendLGAirConditionerDemo.cpp
*
* Sending LG air conditioner IR codes controlled by Serial input
* Based on he old IRremote source from https://github.com/chaeplin
*
* For Arduino Uno, Nano etc., an IR LED must be connected to PWM pin 3 (IR_SEND_PIN).
*
*
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
*
************************************************************************************
@ -173,13 +170,14 @@ delay(4000); // To be able to connect Serial monitor after reset or power up and
#endif
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
Serial.print(F("Ready to send IR signals at pin "));
Serial.println(IR_SEND_PIN);
/*
* The IR library setup. That's all!
*/
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin
Serial.print(F("Ready to send IR signals at pin "));
Serial.println(IR_SEND_PIN);
delay(1000);

View File

@ -0,0 +1,185 @@
/*
* 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 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
*
* This file is part of IRMP 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
* -----------------------------------------
* DEFAULT/AVR 2 3 4
* ATtinyX5 0 4 3
* ATtin167 9 8 5 // Digispark pro number schema
* ATtin167 3 2 7
* ATtin3217 10 11 3 // TinyCore schema
* SAMD21 3 4 5
* ESP8266 14 // D5 12 // D6 %
* ESP32 15 4 %
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
*/
//#define IRMP_MEASURE_TIMING // For debugging purposes.
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
// Timer 3 of IRMP 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
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
//#include "ATtinySerialOut.h"
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
# if defined(ARDUINO_AVR_DIGISPARK)
#define LED_BUILTIN PB1
# endif
#define IR_RECEIVE_PIN 0
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
#define TONE_PIN 3
//#define IR_TIMING_TEST_PIN 3
# else
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.
# if defined(ARDUINO_AVR_DIGISPARKPRO)
#define LED_BUILTIN 1 // PB1 - on Digispark board labeled as pin 1 / for ATtinyCore lib use D9
#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
#define IR_TIMING_TEST_PIN 10 // PA4
# else
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 2
#define TONE_PIN 7
# endif
# endif
#elif defined(__AVR_ATtiny3217__)
#define IR_RECEIVE_PIN 10
#define IR_SEND_PIN 11
#define TONE_PIN 3
# 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
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#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(TEENSYDUINO)
#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(__AVR__)
#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
#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
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
// Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13/PA17.
// Attention!!! D2 and D4 are switched 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
#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)
/*
* Helper macro for getting a macro definition as string
*/
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

View File

@ -1,8 +1,8 @@
/*
* IRsendProntoDemo.cpp
* SendProntoDemo.cpp
*
* Example for sending pronto codes with the IRremote library.
* The code used here is for NEC protocol.
* The code used here, sends NEC protocol data.
*
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
*
@ -58,10 +58,11 @@ void setup() {
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin
Serial.print(F("Ready to send IR signals at pin "));
Serial.println(IR_SEND_PIN);
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
}
void loop() {

View File

@ -0,0 +1,185 @@
/*
* 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 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
*
* This file is part of IRMP 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
* -----------------------------------------
* DEFAULT/AVR 2 3 4
* ATtinyX5 0 4 3
* ATtin167 9 8 5 // Digispark pro number schema
* ATtin167 3 2 7
* ATtin3217 10 11 3 // TinyCore schema
* SAMD21 3 4 5
* ESP8266 14 // D5 12 // D6 %
* ESP32 15 4 %
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
*/
//#define IRMP_MEASURE_TIMING // For debugging purposes.
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
// Timer 3 of IRMP 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
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
//#include "ATtinySerialOut.h"
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
# if defined(ARDUINO_AVR_DIGISPARK)
#define LED_BUILTIN PB1
# endif
#define IR_RECEIVE_PIN 0
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
#define TONE_PIN 3
//#define IR_TIMING_TEST_PIN 3
# else
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.
# if defined(ARDUINO_AVR_DIGISPARKPRO)
#define LED_BUILTIN 1 // PB1 - on Digispark board labeled as pin 1 / for ATtinyCore lib use D9
#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
#define IR_TIMING_TEST_PIN 10 // PA4
# else
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 2
#define TONE_PIN 7
# endif
# endif
#elif defined(__AVR_ATtiny3217__)
#define IR_RECEIVE_PIN 10
#define IR_SEND_PIN 11
#define TONE_PIN 3
# 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
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#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(TEENSYDUINO)
#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(__AVR__)
#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
#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
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
// Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13/PA17.
// Attention!!! D2 and D4 are switched 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
#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)
/*
* Helper macro for getting a macro definition as string
*/
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

View File

@ -1,9 +1,5 @@
/*
* IRsendRawDemo.cpp - demonstrates sending IR codes with sendRaw
* An IR LED must be connected to Arduino PWM pin 3.
* Initially coded 2009 Ken Shirriff http://www.righto.com
*
* IRsendRawDemo - added by AnalysIR (via www.AnalysIR.com), 24 August 2015
* SendRawDemo.cpp - demonstrates sending IR codes with sendRaw
*
* This example shows how to send a RAW signal using the IRremote library.
* The example signal is actually a 32 bit NEC signal.
@ -62,10 +58,11 @@ void setup() {
#endif
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin
Serial.print(F("Ready to send IR signals at pin "));
Serial.println(IR_SEND_PIN);
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
}
/*

View File

@ -9,7 +9,7 @@
*
* This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* IRMP is free software: you can redistribute it and/or modify
* 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.
@ -44,19 +44,19 @@
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
@ -101,34 +101,58 @@
#define IR_SEND_PIN 11
#define TONE_PIN 3
# 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
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(TEENSYDUINO)
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(__AVR__)
#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 IR_TIMING_TEST_PIN 6
#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
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
#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 IR_TIMING_TEST_PIN 6
#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
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
@ -146,10 +170,12 @@
#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 IR_TIMING_TEST_PIN 6
#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)
/*

View File

@ -9,7 +9,7 @@
*
* This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote.
*
* IRMP is free software: you can redistribute it and/or modify
* 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.
@ -44,19 +44,19 @@
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
@ -101,34 +101,58 @@
#define IR_SEND_PIN 11
#define TONE_PIN 3
# 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
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(TEENSYDUINO)
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 4
#define TONE_PIN 5
#define IR_TIMING_TEST_PIN 6
#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(__AVR__)
#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 IR_TIMING_TEST_PIN 6
#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
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
#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 IR_TIMING_TEST_PIN 6
#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
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
@ -146,10 +170,12 @@
#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 IR_TIMING_TEST_PIN 6
#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)
/*

View File

@ -2,9 +2,7 @@
* SimpleSender.cpp
*
* Demonstrates sending IR codes in standard format with address and command
* An extended example for sending can be found as IRsendDemo.
*
* For Arduino Uno, Nano etc., an IR LED must be connected to PWM pin 3 (IR_SEND_PIN).
* An extended example for sending can be found as SendDemo.
*
* Copyright (C) 2020-2021 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
@ -32,13 +30,14 @@ void setup() {
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
Serial.print(F("Ready to send IR signals at pin "));
Serial.println(IR_SEND_PIN);
/*
* The IR library setup. That's all!
*/
IrSender.begin(IR_SEND_PIN, true); // Specify send pin and enable feedback LED at default feedback LED pin
IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin
Serial.print(F("Ready to send IR signals at pin "));
Serial.println(IR_SEND_PIN);
}
/*
@ -74,7 +73,6 @@ void loop() {
*/
// Serial.println(F("Send NECRaw 0xCB340102"));
// IrSender.sendNECRaw(0xCB340102, sRepeats);
/*
* Increment send values
* Also increment address just for demonstration, which normally makes no sense
@ -87,5 +85,5 @@ void loop() {
sRepeats = 4;
}
delay(5000); // delay must be greater than 5 ms (RECORD_GAP_MICROS), otherwise the receiver sees it as one long signal
delay(1000); // delay must be greater than 5 ms (RECORD_GAP_MICROS), otherwise the receiver sees it as one long signal
}

View File

@ -0,0 +1,185 @@
/*
* 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 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
*
* This file is part of IRMP 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
* -----------------------------------------
* DEFAULT/AVR 2 3 4
* ATtinyX5 0 4 3
* ATtin167 9 8 5 // Digispark pro number schema
* ATtin167 3 2 7
* ATtin3217 10 11 3 // TinyCore schema
* SAMD21 3 4 5
* ESP8266 14 // D5 12 // D6 %
* ESP32 15 4 %
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
*/
//#define IRMP_MEASURE_TIMING // For debugging purposes.
//
#if defined(ESP8266)
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
#define IR_RECEIVE_PIN 14 // D5
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
#define tone(a,b) void() // tone() inhibits receive timer
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#define IR_TIMING_TEST_PIN 13 // D7
#elif defined(ESP32)
#define IR_RECEIVE_PIN 15 // D15
#define IR_SEND_PIN 4 // D4
#define tone(a,b) void() // no tone() available on ESP32
#define noTone(a) void()
#define TONE_PIN 42 // Dummy for examples using it
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
// BluePill in 2 flavors
// Timer 3 of IRMP 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
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
//#include "ATtinySerialOut.h"
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
# if defined(ARDUINO_AVR_DIGISPARK)
#define LED_BUILTIN PB1
# endif
#define IR_RECEIVE_PIN 0
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
#define TONE_PIN 3
//#define IR_TIMING_TEST_PIN 3
# else
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.
# if defined(ARDUINO_AVR_DIGISPARKPRO)
#define LED_BUILTIN 1 // PB1 - on Digispark board labeled as pin 1 / for ATtinyCore lib use D9
#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
#define IR_TIMING_TEST_PIN 10 // PA4
# else
#define IR_RECEIVE_PIN 3
#define IR_SEND_PIN 2
#define TONE_PIN 7
# endif
# endif
#elif defined(__AVR_ATtiny3217__)
#define IR_RECEIVE_PIN 10
#define IR_SEND_PIN 11
#define TONE_PIN 3
# 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
#elif defined(ARDUINO_ARCH_APOLLO3)
#define IR_RECEIVE_PIN 11
#define IR_SEND_PIN 12
#define TONE_PIN 5
#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(TEENSYDUINO)
#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(__AVR__)
#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
#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
// On the Zero and others we switch explicitly to SerialUSB
#define Serial SerialUSB
// Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13/PA17.
// Attention!!! D2 and D4 are switched 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
#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)
/*
* Helper macro for getting a macro definition as string
*/
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

View File

@ -0,0 +1,349 @@
/*
* UnitTest.cpp
*
* Demonstrates sending IR codes in standard format with address and command
*
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
*
************************************************************************************
* MIT License
*
* Copyright (c) 2020-2021 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 macros for input and output pin etc.
*/
#include "PinDefinitionsAndMore.h"
//#define EXCLUDE_EXOTIC_PROTOCOLS // saves around 240 bytes program space if IrSender.write is used
//#define SEND_PWM_BY_TIMER
//#define USE_NO_SEND_PWM
//#define IR_MEASURE_TIMING
#define MARK_EXCESS_MICROS -40 // for my VS1838 to get Denon right
#define DISABLE_LED_FEEDBACK_FOR_RECEIVE // halves ISR duration
#include <IRremote.h>
#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_LOOP 5000
void setup() {
pinMode(DEBUG_BUTTON_PIN, INPUT_PULLUP);
#if defined(IR_TIMING_TEST_PIN)
pinMode(IR_TIMING_TEST_PIN, OUTPUT);
#endif
Serial.begin(115200);
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL) || defined(ARDUINO_attiny3217)
delay(4000); // To be able to connect Serial monitor after reset or power up and before first printout
#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, enable feedback LED and (if not 3. parameter specified) take LED feedback pin from the internal boards definition
*/
IrReceiver.begin(IR_RECEIVE_PIN);
IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin
Serial.print(F("Ready to receive IR signals at pin "));
Serial.println(IR_RECEIVE_PIN);
Serial.print(F("Ready to send IR signals at pin "));
Serial.println(IR_SEND_PIN);
#if defined(USE_SOFT_SEND_PWM) && !defined(ESP32) // for esp32 we use PWM generation by hw_timer_t for each pin
/*
* Print internal signal generation info
*/
IrSender.enableIROut(38);
Serial.print(F("Send signal mark duration is "));
Serial.print(IrSender.periodOnTimeMicros);
Serial.print(F(" us, pulse correction is "));
Serial.print((uint16_t) PULSE_CORRECTION_NANOS);
Serial.print(F(" ns, total period is "));
Serial.print(IrSender.periodTimeMicros);
Serial.println(F(" us"));
#endif
// infos for receive
Serial.print(MARK_EXCESS_MICROS);
Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding"));
}
void checkReceive(uint16_t aSentAddress, uint16_t aSentCommand) {
// wait until signal has received
delay((RECORD_GAP_MICROS / 1000) + 1);
if (IrReceiver.decode()) {
// Print a short summary of received data
IrReceiver.printIRResultShort(&Serial);
if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(DEBUG_BUTTON_PIN) == LOW) {
// We have an unknown protocol, print more info
IrReceiver.printIRResultRawFormatted(&Serial, true);
} else {
/*
* Check address
*/
if (IrReceiver.decodedIRData.address != aSentAddress) {
Serial.print(F("ERROR: Received address=0x"));
Serial.print(IrReceiver.decodedIRData.address, HEX);
Serial.print(F(" != sent address=0x"));
Serial.println(aSentAddress, HEX);
}
/*
* Check command
*/
if (IrReceiver.decodedIRData.command != aSentCommand) {
Serial.print(F("ERROR: Received command=0x"));
Serial.print(IrReceiver.decodedIRData.command, HEX);
Serial.print(F(" != sent command=0x"));
Serial.println(aSentCommand, HEX);
}
}
IrReceiver.resume();
} else {
Serial.println(F("No data received"));
}
Serial.println();
}
/*
* Set up the data to be sent.
* For most protocols, the data is build up with a constant 8 (or 16 byte) address
* and a variable 8 bit command.
* There are exceptions like Sony and Denon, which have 5 bit address.
*/
uint16_t sAddress = 0xFFF1;
uint8_t sCommand = 0x76;
uint8_t sRepeats = 0;
void loop() {
/*
* Print values
*/
Serial.println();
Serial.print(F("address=0x"));
Serial.print(sAddress, HEX);
Serial.print(F(" command=0x"));
Serial.print(sCommand, HEX);
Serial.print(F(" repeats="));
Serial.println(sRepeats);
Serial.println();
Serial.println();
Serial.println(F("Send NEC with 8 bit address"));
Serial.flush();
IrSender.sendNEC(sAddress & 0xFF, sCommand, sRepeats);
checkReceive(sAddress & 0xFF, sCommand);
delay(DELAY_AFTER_SEND); // delay must be greater than 5 ms (RECORD_GAP_MICROS), otherwise the receiver sees it as one long signal
Serial.println(F("Send NEC with 16 bit address"));
Serial.flush();
IrSender.sendNEC(sAddress, sCommand, sRepeats);
checkReceive(sAddress, sCommand);
delay(DELAY_AFTER_SEND);
if (sRepeats == 0) {
/*
* Send constant values only once in this demo
*/
Serial.println(F("Sending NEC Pronto data with 8 bit address 0x80 and command 0x45 and no repeats"));
Serial.flush();
IrSender.sendPronto(F("0000 006D 0022 0000 015E 00AB " /* Pronto header + start bit */
"0017 0015 0017 0015 0017 0017 0015 0017 0017 0015 0017 0015 0017 0015 0017 003F " /* Lower address byte */
"0017 003F 0017 003E 0017 003F 0015 003F 0017 003E 0017 003F 0017 003E 0017 0015 " /* Upper address byte (inverted at 8 bit mode) */
"0017 003E 0017 0015 0017 003F 0017 0015 0017 0015 0017 0015 0017 003F 0017 0015 " /* command byte */
"0019 0013 0019 003C 0017 0015 0017 003F 0017 003E 0017 003F 0017 0015 0017 003E " /* inverted command byte */
"0017 0806"), 0); //stop bit, no repeat possible, because of missing repeat pattern
checkReceive(0x80, 0x45);
delay(DELAY_AFTER_SEND);
/*
* With sendNECRaw() you can send even "forbidden" codes with parity errors
*/
Serial.println(
F(
"Send NEC with 16 bit address 0x0102 and command 0x34 with NECRaw(0xCC340102) which results in a parity error, since 34 == ~CB and not C0"));
Serial.flush();
IrSender.sendNECRaw(0xC0340102, sRepeats);
checkReceive(0x0102, 0x34);
delay(DELAY_AFTER_SEND);
/*
* With Send sendNECMSB() you can send your old 32 bit codes.
* To convert one into the other, you must reverse the byte positions and then reverse all positions of each byte.
* Example:
* 0xCB340102 byte reverse -> 0x020134CB bit reverse-> 40802CD3
*/
Serial.println(F("Send NEC with 16 bit address 0x0102 and command 0x34 with old 32 bit format MSB first"));
Serial.flush();
IrSender.sendNECMSB(0x40802CD3, 32, false);
checkReceive(0x0102, 0x34);
delay(DELAY_AFTER_SEND);
}
Serial.println(F("Send Apple"));
Serial.flush();
IrSender.sendApple(sAddress & 0xFF, sCommand, sRepeats);
checkReceive(sAddress & 0xFF, sCommand);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Panasonic"));
Serial.flush();
IrSender.sendPanasonic(sAddress & 0xFFF, sCommand, sRepeats);
checkReceive(sAddress & 0xFFF, sCommand);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Kaseikyo with 0x4711 as Vendor ID"));
Serial.flush();
IrSender.sendKaseikyo(sAddress & 0xFFF, sCommand, sRepeats, 0x4711);
checkReceive(sAddress & 0xFFF, sCommand);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Denon"));
Serial.flush();
IrSender.sendDenon(sAddress & 0x1F, sCommand, sRepeats);
checkReceive(sAddress & 0x1F, sCommand);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Denon/Sharp variant"));
Serial.flush();
IrSender.sendSharp(sAddress & 0x1F, sCommand, sRepeats);
checkReceive(sAddress & 0x1F, sCommand);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Sony/SIRCS with 7 command and 5 address bits"));
Serial.flush();
IrSender.sendSony(sAddress & 0x1F, sCommand & 0x7F, sRepeats);
checkReceive(sAddress & 0x1F, sCommand & 0x7F);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Sony/SIRCS with 7 command and 8 address bits"));
Serial.flush();
IrSender.sendSony(sAddress & 0xFF, sCommand, sRepeats, SIRCS_15_PROTOCOL);
checkReceive(sAddress & 0xFF, sCommand & 0x7F);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Sony/SIRCS with 7 command and 13 address bits"));
Serial.flush();
IrSender.sendSony(sAddress & 0x1FFF, sCommand & 0x7F, sRepeats, SIRCS_20_PROTOCOL);
checkReceive(sAddress & 0x1FFF, sCommand & 0x7F);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send RC5"));
Serial.flush();
IrSender.sendRC5(sAddress & 0x1F, sCommand & 0x3F, sRepeats, true); // 5 address, 6 command bits
checkReceive(sAddress & 0x1F, sCommand & 0x3F);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send RC5X with 7.th MSB of command set"));
Serial.flush();
IrSender.sendRC5(sAddress & 0x1F, (sCommand & 0x3F) + 0x40, sRepeats, true); // 5 address, 7 command bits
checkReceive(sAddress & 0x1F, (sCommand & 0x3F) + 0x40);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send RC6"));
// RC6 check does not work stable without the flush
Serial.flush();
IrSender.sendRC6(sAddress & 0xFF, sCommand, sRepeats, true);
checkReceive(sAddress & 0xFF, sCommand);
delay(DELAY_AFTER_SEND);
/*
* Next example how to use the IrSender.write function
*/
IRData IRSendData;
// prepare data
IRSendData.address = sAddress;
IRSendData.command = sCommand;
IRSendData.flags = IRDATA_FLAGS_EMPTY;
IRSendData.protocol = SAMSUNG;
Serial.print(F("Send "));
Serial.println(getProtocolString(IRSendData.protocol));
Serial.flush();
IrSender.write(&IRSendData, sRepeats);
checkReceive(IRSendData.address, IRSendData.command);
delay(DELAY_AFTER_SEND);
IRSendData.protocol = JVC; // switch protocol
Serial.print(F("Send "));
Serial.println(getProtocolString(IRSendData.protocol));
Serial.flush();
IrSender.write(&IRSendData, sRepeats);
checkReceive(IRSendData.address & 0xFF, IRSendData.command);
delay(DELAY_AFTER_SEND);
IRSendData.protocol = LG;
IRSendData.command = sCommand << 8 | sCommand; // LG supports 16 bit command
Serial.print(F("Send "));
Serial.println(getProtocolString(IRSendData.protocol));
Serial.flush();
IrSender.write(&IRSendData, sRepeats);
checkReceive(IRSendData.address & 0xFF, IRSendData.command);
delay(DELAY_AFTER_SEND);
IRSendData.protocol = BOSEWAVE;
Serial.println(F("Send Bosewave with no address and 8 command bits"));
Serial.flush();
IrSender.write(&IRSendData, sRepeats);
checkReceive(0, IRSendData.command & 0xFF);
delay(DELAY_AFTER_SEND);
/*
* LEGO is difficult to receive because of its short marks and spaces
*/
// Serial.println(F("Send Lego with 2 channel and with 4 command bits"));
// Serial.flush();
// IrSender.sendLegoPowerFunctions(sAddress, sCommand, LEGO_MODE_COMBO, true);
// checkReceive(sAddress, sCommand); // never has success for Lego protocol :-(
// delay(DELAY_AFTER_SEND);
/*
* Force buffer overflow
*/
Serial.println(F("Force buffer overflow by sending 100 marks and spaces"));
for (unsigned int i = 0; i < RAW_BUFFER_LENGTH; ++i) {
IrSender.mark(400);
IrSender.space(400);
}
checkReceive(sAddress, sCommand);
delay(DELAY_AFTER_SEND);
/*
* Increment values
* Also increment address just for demonstration, which normally makes no sense
*/
sAddress += 0x0101;
sCommand += 0x11;
delay(DELAY_AFTER_LOOP); // additional delay at the end of each loop
}

View File

@ -0,0 +1,146 @@
START ../src/UnitTest.cpp from Mar 8 2021
Using library version 3.1.0
Ready to receive IR signals at pin 2
Ready to send IR signals at pin 3
Send signal mark duration is 5 us, pulse correction is 3000 ns, total period is 26 us
-40 us are subtracted from all marks and added to all spaces for decoding
address=0xFFF1 command=0x76 repeats=0
Send NEC with 8 bit address
Protocol=NEC Address=0xF1 Command=0x76 Raw-Data=0x89760EF1 32 bits LSB first
Send NEC with 16 bit address
Protocol=NEC Address=0xFFF1 Command=0x76 Raw-Data=0x8976FFF1 32 bits LSB first
Sending NEC Pronto data with 8 bit address 0x80 and command 0x45 and no repeats
Protocol=NEC Address=0x80 Command=0x45 Raw-Data=0xBA457F80 32 bits LSB first
Send NEC with 16 bit address 0x0102 and command 0x34 with NECRaw(0xCC340102) which results in a parity error, since 34 == ~CB and not C0
Protocol=NEC Address=0x102 Command=0x34 Parity fail Raw-Data=0xC0340102 32 bits LSB first
Send NEC with 16 bit address 0x0102 and command 0x34 with old 32 bit format MSB first
Protocol=NEC Address=0x102 Command=0x34 Raw-Data=0xCB340102 32 bits LSB first
Send Apple
Protocol=APPLE Address=0xF1 Command=0x76 Raw-Data=0xF17687EE 32 bits LSB first
Send Panasonic
Protocol=PANASONIC Address=0xFF1 Command=0x76 Raw-Data=0x9976FF10 48 bits LSB first
Send Kaseikyo with 0x4711 as Vendor ID
Protocol=KASEIKYO Address=0xFF1 Command=0x76 Extra=0x4711 Raw-Data=0x9A76FF13 48 bits LSB first
Send Denon
Protocol=DENON Address=0x11 Command=0x76 Raw-Data=0x45D8 15 bits MSB first
Send Denon/Sharp variant
Protocol=SHARP Address=0x11 Command=0x76 Raw-Data=0x45DA 15 bits MSB first
Send Sony/SIRCS with 7 command and 5 address bits
Protocol=SONY Address=0x11 Command=0x76 Raw-Data=0x8F6 12 bits LSB first
Send Sony/SIRCS with 7 command and 8 address bits
Protocol=SONY Address=0xF1 Command=0x76 Raw-Data=0x78F6 15 bits LSB first
Send Sony/SIRCS with 7 command and 13 address bits
Protocol=SONY Address=0x1FF1 Command=0x76 Raw-Data=0xFF8F6 20 bits LSB first
Send RC5
Protocol=RC5 Address=0x11 Command=0x36 Toggle=1 Raw-Data=0x3C76 13 bits MSB first
Send RC5X with 7.th MSB of command set
Protocol=RC5 Address=0x11 Command=0x76 Raw-Data=0x2476 13 bits MSB first
Send RC6
Protocol=RC6 Address=0xF1 Command=0x76 Raw-Data=0xF176 16 bits MSB first
Send SAMSUNG
Protocol=SAMSUNG Address=0xFFF1 Command=0x76 Raw-Data=0x8976FFF1 32 bits LSB first
Send JVC
Protocol=JVC Address=0xF1 Command=0x76 Raw-Data=0x76F1 16 bits LSB first
Send LG
Protocol=LG Address=0xF1 Command=0x7676 Raw-Data=0xF17676A 28 bits MSB first
Send Bosewave with no address and 8 command bits
Protocol=BOSEWAVE Address=0x0 Command=0x76 Raw-Data=0x8976 16 bits LSB first
Force buffer overflow by sending 100 marks and spaces
Protocol=UNKNOWN Hash=0x0 0 bits received
rawData[0]:
-999300
address=0xF2 command=0x87 repeats=0
Send NEC with 8 bit address
Protocol=NEC Address=0xF2 Command=0x87 Raw-Data=0x78870DF2 32 bits LSB first
Send NEC with 16 bit address
Protocol=NEC Address=0xF2 Command=0x87 Raw-Data=0x78870DF2 32 bits LSB first
Sending NEC Pronto data with 8 bit address 0x80 and command 0x45 and no repeats
Protocol=NEC Address=0x80 Command=0x45 Raw-Data=0xBA457F80 32 bits LSB first
Send NEC with 16 bit address 0x0102 and command 0x34 with NECRaw(0xCC340102) which results in a parity error, since 34 == ~CB and not C0
Protocol=NEC Address=0x102 Command=0x34 Parity fail Raw-Data=0xC0340102 32 bits LSB first
Send NEC with 16 bit address 0x0102 and command 0x34 with old 32 bit format MSB first
Protocol=NEC Address=0x102 Command=0x34 Raw-Data=0xCB340102 32 bits LSB first
Send Apple
Protocol=APPLE Address=0xF2 Command=0x87 Raw-Data=0xF28787EE 32 bits LSB first
Send Panasonic
Protocol=PANASONIC Address=0xF2 Command=0x87 Raw-Data=0xA8870F20 48 bits LSB first
Send Kaseikyo with 0x4711 as Vendor ID
Protocol=KASEIKYO Address=0xF2 Command=0x87 Extra=0x4711 Raw-Data=0xAB870F23 48 bits LSB first
Send Denon
Protocol=DENON Address=0x12 Command=0x87 Raw-Data=0x4A1C 15 bits MSB first
Send Denon/Sharp variant
Protocol=SHARP Address=0x12 Command=0x87 Raw-Data=0x4A1E 15 bits MSB first
Send Sony/SIRCS with 7 command and 5 address bits
Protocol=SONY Address=0x12 Command=0x7 Raw-Data=0x907 12 bits LSB first
Send Sony/SIRCS with 7 command and 8 address bits
Protocol=SONY Address=0xF2 Command=0x7 Raw-Data=0x7907 15 bits LSB first
Send Sony/SIRCS with 7 command and 13 address bits
Protocol=SONY Address=0xF2 Command=0x7 Raw-Data=0x7907 20 bits LSB first
Send RC5
Protocol=RC5 Address=0x12 Command=0x7 Raw-Data=0x3487 13 bits MSB first
Send RC5X with 7.th MSB of command set
Protocol=RC5 Address=0x12 Command=0x47 Toggle=1 Raw-Data=0x2C87 13 bits MSB first
Send RC6
Protocol=RC6 Address=0xF2 Command=0x87 Raw-Data=0xF287 16 bits MSB first
Send SAMSUNG
Protocol=SAMSUNG Address=0xF2 Command=0x87 Raw-Data=0x788700F2 32 bits LSB first
Send JVC
Protocol=JVC Address=0xF2 Command=0x87 Raw-Data=0x87F2 16 bits LSB first
Send LG
Protocol=LG Address=0xF2 Command=0x8787 Raw-Data=0xF28787E 28 bits MSB first
Send Bosewave with no address and 8 command bits
Protocol=BOSEWAVE Address=0x0 Command=0x87 Raw-Data=0x7887 16 bits LSB first
Force buffer overflow by sending 100 marks and spaces
Protocol=UNKNOWN Hash=0x0 0 bits received
rawData[0]:
-999250

View File

@ -35,11 +35,13 @@
* Enable/disable blinking of Feedback LED (LED_BUILTIN is taken as default) on IR processing
* If FeedbackLEDPin == 0, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
*/
void LEDFeedback(bool aEnableLEDFeedback) {
void setLEDFeedback(uint8_t aFeedbackLEDPin, bool aEnableLEDFeedback) {
FeedbackLEDControl.FeedbackLEDPin = aFeedbackLEDPin; // default is 0
FeedbackLEDControl.LedFeedbackEnabled = aEnableLEDFeedback;
if (aEnableLEDFeedback) {
if (FeedbackLEDControl.FeedbackLEDPin != 0) {
pinMode(FeedbackLEDControl.FeedbackLEDPin, OUTPUT);
if (aFeedbackLEDPin != 0) {
pinMode(aFeedbackLEDPin, OUTPUT);
#ifdef FEEDBACK_LED
} else {
pinMode(FEEDBACK_LED, OUTPUT);
@ -56,13 +58,6 @@ void disableLEDFeedback() {
FeedbackLEDControl.LedFeedbackEnabled = false;
}
/*
* @ param aFeedbackLEDPin if 0, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
*/
void setFeedbackLEDPin(uint8_t aFeedbackLEDPin) {
FeedbackLEDControl.FeedbackLEDPin = aFeedbackLEDPin;
}
/*
* Flash LED while receiving IR data, if enabled
*/
@ -103,8 +98,8 @@ void setFeedbackLED(bool aSwitchLedOn) {
* Old deprecated function names
*/
void blink13(bool aEnableLEDFeedback) {
LEDFeedback(aEnableLEDFeedback);
setLEDFeedback(FeedbackLEDControl.FeedbackLEDPin, aEnableLEDFeedback);
}
void setBlinkPin(uint8_t aBlinkPin) {
setFeedbackLEDPin(aBlinkPin);
setLEDFeedback(aBlinkPin, FeedbackLEDControl.LedFeedbackEnabled);
}

View File

@ -47,13 +47,17 @@ struct irparams_struct irparams; // the irparams instance
* @param IRReceivePin Arduino pin to use. No sanity check is made.
*/
IRrecv::IRrecv() {
irparams.IRReceivePin = 0;
FeedbackLEDControl.LedFeedbackEnabled = false;
setReceivePin(0);
#if !defined(DISABLE_LED_FEEDBACK_FOR_RECEIVE)
setLEDFeedback(0, false);
#endif
}
IRrecv::IRrecv(uint8_t aReceivePin) {
irparams.IRReceivePin = aReceivePin;
FeedbackLEDControl.LedFeedbackEnabled = false;
setReceivePin(aReceivePin);
#if !defined(DISABLE_LED_FEEDBACK_FOR_RECEIVE)
setLEDFeedback(0, false);
#endif
}
/**
* Instantiate the IRrecv class. Multiple instantiation is not supported.
@ -61,10 +65,12 @@ IRrecv::IRrecv(uint8_t aReceivePin) {
* @ param aFeedbackLEDPin if 0, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
*/
IRrecv::IRrecv(uint8_t aReceivePin, uint8_t aFeedbackLEDPin) {
irparams.IRReceivePin = aReceivePin;
FeedbackLEDControl.FeedbackLEDPin = aFeedbackLEDPin;
pinMode(aFeedbackLEDPin, OUTPUT);
FeedbackLEDControl.LedFeedbackEnabled = false;
setReceivePin(aReceivePin);
#if !defined(DISABLE_LED_FEEDBACK_FOR_RECEIVE)
setLEDFeedback(aFeedbackLEDPin, false);
#else
(void) aFeedbackLEDPin;
#endif
}
/**********************************************************************************************************************
@ -76,13 +82,25 @@ IRrecv::IRrecv(uint8_t aReceivePin, uint8_t aFeedbackLEDPin) {
*/
void IRrecv::begin(uint8_t aReceivePin, bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin) {
irparams.IRReceivePin = aReceivePin;
FeedbackLEDControl.FeedbackLEDPin = aFeedbackLEDPin; // default is 0
LEDFeedback(aEnableLEDFeedback);
setReceivePin(aReceivePin);
#if !defined(DISABLE_LED_FEEDBACK_FOR_RECEIVE)
setLEDFeedback(aFeedbackLEDPin, aEnableLEDFeedback);
#else
(void) aEnableLEDFeedback;
(void) aFeedbackLEDPin;
#endif
enableIRIn();
}
void IRrecv::setReceivePin(uint8_t aReceivePinNumber) {
irparams.IRReceivePin = aReceivePinNumber;
#if defined(__AVR__)
irparams.IRReceivePinMask = digitalPinToBitMask(aReceivePinNumber);
irparams.IRReceivePinPortInputRegister = portInputRegister(digitalPinToPort(aReceivePinNumber));
#endif
}
void IRrecv::start() {
enableIRIn();
}
@ -665,24 +683,24 @@ uint8_t IRrecv::compare(unsigned int oldval, unsigned int newval) {
}
return 1;
}
//+=============================================================================
// hashdecode - decode an arbitrary IR code.
// Instead of decoding using a standard encoding scheme
// (e.g. Sony, NEC, RC5), the code is hashed to a 32-bit value.
//
// The algorithm: look at the sequence of MARK signals, and see if each one
// is shorter (0), the same length (1), or longer (2) than the previous.
// Do the same with the SPACE signals. Hash the resulting sequence of 0's,
// 1's, and 2's to a 32-bit value. This will give a unique value for each
// different code (probably), for most code systems.
//
// Use FNV hash algorithm: http://isthe.com/chongo/tech/comp/fnv/#FNV-param
// Converts the raw code values into a 32-bit hash code.
// Hopefully this code is unique for each button.
// This isn't a "real" decoding, just an arbitrary value.
//
// see: http://arcfn.com/2010/01/using-arbitrary-remotes-with-arduino.html
//
/**
* hashdecode - decode an arbitrary IR code.
* Instead of decoding using a standard encoding scheme
* (e.g. Sony, NEC, RC5), the code is hashed to a 32-bit value.
*
* The algorithm: look at the sequence of MARK signals, and see if each one
* is shorter (0), the same length (1), or longer (2) than the previous.
* Do the same with the SPACE signals. Hash the resulting sequence of 0's,
* 1's, and 2's to a 32-bit value. This will give a unique value for each
* different code (probably), for most code systems.
*
* Use FNV hash algorithm: http://isthe.com/chongo/tech/comp/fnv/#FNV-param
* Converts the raw code values into a 32-bit hash code.
* Hopefully this code is unique for each button.
* This isn't a "real" decoding, just an arbitrary value.
*
* see: http://arcfn.com/2010/01/using-arbitrary-remotes-with-arduino.html
*/
#define FNV_PRIME_32 16777619
#define FNV_BASIS_32 2166136261
@ -829,7 +847,7 @@ bool MATCH_SPACE(uint16_t measured_ticks, uint16_t desired_us) {
return matchSpace(measured_ticks, desired_us);
}
// used for ir_Pronto
// Function used for ir_Pronto
int getMarkExcessMicros() {
return MARK_EXCESS_MICROS;
}
@ -947,9 +965,9 @@ void IRrecv::printIRResultMinimal(Print *aSerial) {
}
}
//+=============================================================================
// Dump out the decode_results structure
//
/**
* Dump out the decode_results structure
*/
void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsInsteadOfTicks) {
// Print Raw data
aSerial->print(F("rawData["));
@ -1002,7 +1020,7 @@ void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsI
aSerial->println(""); // Newline
}
/*
/**
* Dump out the decode_results structure to be used for sendRaw().
* Compensate received values by MARK_EXCESS_MICROS, like it is done for decoding!
*
@ -1058,7 +1076,7 @@ void IRrecv::compensateAndPrintIRResultAsCArray(Print *aSerial, bool aOutputMicr
aSerial->println("");
}
/*
/**
* Store the decode_results structure to be used for sendRaw().
* Compensate received values by MARK_EXCESS_MICROS, like it is done for decoding!
*
@ -1189,9 +1207,15 @@ const char* getProtocolString(decode_type_t aProtocol) {
* As soon as one SPACE entry gets longer than RECORD_GAP_TICKS, state switches to STOP (frame received). Timing of SPACE continues.
* A call of resume() switches from STOP to IDLE.
* As soon as first MARK arrives in IDLE, gap width is recorded and new logging starts.
*
* With digitalRead and Feedback LED
* 15 pushs, 1 in, 1 eor before start of code = 2 us @16MHz + * 7.2 us computation time + * pop + reti = 2.25 us @16MHz => 11.5 us @16MHz
* With portInputRegister and mask and Feedback LED code commented
* 9 pushs, 1 in, 1 eor before start of code = 1.25 us @16MHz + * 2.25 us computation time + * pop + reti = 1.5 us @16MHz => 5 us @16MHz
*
**********************************************************************************************************************/
//#define IR_MEASURE_TIMING
//#define IR_TIMING_TEST_PIN 7 // do not forget to execute: pinMode(7, OUTPUT);
//#define IR_TIMING_TEST_PIN 7 // do not forget to execute: pinMode(IR_TIMING_TEST_PIN, OUTPUT);
#if defined(IR_MEASURE_TIMING) && defined(IR_TIMING_TEST_PIN)
#include "digitalWriteFast.h"
#endif
@ -1209,7 +1233,11 @@ ISR () // for functions definitions which are called by separate (board specific
TIMER_RESET_INTR_PENDING;// reset TickCounterForISR interrupt flag if required (currently only for Teensy and ATmega4809)
// Read if IR Receiver -> SPACE [xmt LED off] or a MARK [xmt LED on]
#if defined(__AVR__)
uint8_t irdata = *irparams.IRReceivePinPortInputRegister & irparams.IRReceivePinMask;
#else
uint8_t irdata = (uint8_t) digitalRead(irparams.IRReceivePin);
#endif
// clip TickCounterForISR at maximum 0xFFFF / 3.2 seconds at 50 us ticks
if (irparams.TickCounterForISR < 0xFFFF) {
@ -1240,7 +1268,7 @@ ISR () // for functions definitions which are called by separate (board specific
}
} else if (irparams.StateForISR == IR_REC_STATE_MARK) { // Timing Mark
if (irdata == SPACE) { // Mark ended; Record time
if (irdata != MARK) { // Mark ended; Record time
#if defined(IR_MEASURE_TIMING) && defined(IR_TIMING_TEST_PIN)
// digitalWriteFast(IR_TIMING_TEST_PIN, HIGH); // 2 clock cycles
#endif
@ -1285,7 +1313,13 @@ ISR () // for functions definitions which are called by separate (board specific
irparams.TickCounterForISR = 0; // Reset gap TickCounterForISR, to prepare for call of resume()
}
}
setFeedbackLED(irdata == MARK);
#if !defined(DISABLE_LED_FEEDBACK_FOR_RECEIVE)
if (FeedbackLEDControl.LedFeedbackEnabled) {
setFeedbackLED(irdata == MARK);
}
#endif
#ifdef IR_MEASURE_TIMING
digitalWriteFast(IR_TIMING_TEST_PIN, LOW); // 2 clock cycles
#endif

View File

@ -38,7 +38,10 @@ __attribute((error("Version > 3.0.1"))) void UsageError(const char *details);
IRsend IrSender;
IRsend::IRsend() {
#if defined(IR_SEND_PIN)
sendPin = IR_SEND_PIN; // take IR_SEND_PIN as default
#endif
setLEDFeedback(0, false);
}
IRsend::IRsend(uint8_t aSendPin) {
@ -52,8 +55,7 @@ void IRsend::setSendPin(uint8_t aSendPin) {
*/
void IRsend::begin(uint8_t aSendPin, bool aEnableLEDFeedback, uint8_t aLEDFeedbackPin) {
sendPin = aSendPin;
FeedbackLEDControl.FeedbackLEDPin = aLEDFeedbackPin; // default is 0
LEDFeedback(aEnableLEDFeedback);
setLEDFeedback(aLEDFeedbackPin, aEnableLEDFeedback);
}
/*
@ -68,8 +70,7 @@ void IRsend::begin(bool aEnableLEDFeedback, uint8_t aLEDFeedbackPin) {
UsageError("Error: You must use begin(<sendPin>, <EnableLEDFeedback>, <LEDFeedbackPin>) if USE_SOFT_SEND_PWM or USE_NO_SEND_PWM is defined!");
#endif
FeedbackLEDControl.FeedbackLEDPin = aLEDFeedbackPin; // default is 0
LEDFeedback(aEnableLEDFeedback);
setLEDFeedback(aLEDFeedbackPin, aEnableLEDFeedback);
}
size_t IRsend::write(IRData *aIRSendData, uint_fast8_t aNumberOfRepeats) {
@ -158,7 +159,6 @@ size_t IRsend::write(IRData *aIRSendData, uint_fast8_t aNumberOfRepeats) {
return 1;
}
//+=============================================================================
void IRsend::sendRaw(const uint16_t aBufferWithMicroseconds[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) {
// Set IR carrier frequency
enableIROut(aIRFrequencyKilohertz);
@ -243,7 +243,6 @@ void IRsend::sendRaw_P(const uint8_t aBufferWithTicks[], uint_fast8_t aLengthOfB
#endif
}
//+=============================================================================
/*
* Sends PulseDistance data
* always ends with a space
@ -326,10 +325,10 @@ void IRsend::sendBiphaseData(unsigned int aBiphaseTimeUnit, uint32_t aData, uint
TRACE_PRINTLN("");
}
//+=============================================================================
// Sends an IR mark for the specified number of microseconds.
// The mark output is modulated at the PWM frequency.
//
/**
* Sends an IR mark for the specified number of microseconds.
* The mark output is modulated at the PWM frequency.
*/
void IRsend::mark(unsigned int aMarkMicros) {
setFeedbackLED(true);
@ -341,7 +340,7 @@ void IRsend::mark(unsigned int aMarkMicros) {
SENDPIN_ON(sendPin);
delayMicroseconds(periodOnTimeMicros); // this is normally implemented by a blocking wait
SENDPIN_OFF(sendPin);
interrupts(); // Enable interrupts for the longer off period
interrupts(); // Enable interrupts -to keep micros correct- for the longer off period 3.4 us until receive ISR is active (for 7 us + pop's)
nextPeriodEnding += periodTimeMicros;
while (micros() < nextPeriodEnding){
}
@ -372,20 +371,19 @@ void IRsend::ledOff() {
setFeedbackLED(false);
}
//+=============================================================================
// Leave pin off for time (given in microseconds)
// Sends an IR space for the specified number of microseconds.
// A space is no output, so the PWM output is disabled.
//
/**
* Sends an IR space for the specified number of microseconds.
* A space is "no output", so the PWM output is disabled.
*/
void IRsend::space(unsigned int aSpaceMicros) {
ledOff();
customDelayMicroseconds(aSpaceMicros);
}
//+=============================================================================
// Custom delay function that circumvents Arduino's delayMicroseconds 16 bit limit
// and is (mostly) not extended by the duration of interrupt codes like the millis() interrupt
/**
* Custom delay function that circumvents Arduino's delayMicroseconds 16 bit limit
* and is (mostly) not extended by the duration of interrupt codes like the millis() interrupt
*/
void IRsend::customDelayMicroseconds(unsigned long aMicroseconds) {
unsigned long start = micros();
// overflow invariant comparison :-)
@ -393,18 +391,18 @@ void IRsend::customDelayMicroseconds(unsigned long aMicroseconds) {
}
}
//+=============================================================================
// Enables IR output. The kHz value controls the modulation frequency in kilohertz.
// The IR output will be on pin 3 (OC2B).
// This routine is designed for 36-40 kHz; if you use it for other values, it's up to you
// to make sure it gives reasonable results. (Watch out for overflow / underflow / rounding.)
// TIMER2 is used in phase-correct PWM mode, with OCR2A controlling the frequency and OCR2B
// controlling the duty cycle.
// There is no prescaling, so the output frequency is 16 MHz / (2 * OCR2A)
// To turn the output on and off, we leave the PWM running, but connect and disconnect the output pin.
// A few hours staring at the ATmega documentation and this will all make sense.
// See my Secrets of Arduino PWM at http://arcfn.com/2009/07/secrets-of-arduino-pwm.html for details.
//
/**
* Enables IR output. The kHz value controls the modulation frequency in kilohertz.
* The IR output will be on pin 3 (OC2B).
* This routine is designed for 36-40 kHz; if you use it for other values, it's up to you
* to make sure it gives reasonable results. (Watch out for overflow / underflow / rounding.)
* TIMER2 is used in phase-correct PWM mode, with OCR2A controlling the frequency and OCR2B
* controlling the duty cycle.
* There is no prescaling, so the output frequency is 16 MHz / (2 * OCR2A)
* To turn the output on and off, we leave the PWM running, but connect and disconnect the output pin.
* A few hours staring at the ATmega documentation and this will all make sense.
* See my Secrets of Arduino PWM at http://arcfn.com/2009/07/secrets-of-arduino-pwm.html for details.
*/
void IRsend::enableIROut(uint8_t aFrequencyKHz) {
#if defined(USE_SOFT_SEND_PWM) && !defined(ESP32) // for esp32 we use PWM generation by hw_timer_t for each pin
periodTimeMicros = (1000U + aFrequencyKHz / 2) / aFrequencyKHz; // rounded value -> 26 for 38 kHz

View File

@ -49,11 +49,11 @@
* PROTOCOLS
****************************************************/
//------------------------------------------------------------------------------
// Supported IR protocols
// Each protocol you include costs memory and, during decode, costs time
// Disable (deactivate the line by adding a trailing comment "//") all the protocols you do not need/want!
//
/*
* Supported IR protocols
* Each protocol you include costs memory and, during decode, costs time
* Disable (deactivate the line by adding a trailing comment "//") all the protocols you do not need/want!
*/
#if (!(defined(DECODE_DENON) || defined(DECODE_SHARP) || defined(DECODE_JVC) || defined(DECODE_KASEIKYO) \
|| defined(DECODE_PANASONIC) || defined(DECODE_LG) || defined(DECODE_NEC) || defined(DECODE_SAMSUNG) \
|| defined(DECODE_SONY) || defined(DECODE_RC5) || defined(DECODE_RC6) || defined(DECODE_HASH) \
@ -88,9 +88,12 @@
* MARK_EXCESS_MICROS is subtracted from all marks and added to all spaces before decoding,
* to compensate for the signal forming of different IR receiver modules
* For Vishay TSOP*, marks tend to be too long and spaces tend to be too short.
* If you set MARK_EXCESS to approx. 50us then the TSOP4838 works best.
* If you set MARK_EXCESS_MICROS to approx. 50us then the TSOP4838 works best.
* At 100us it also worked, but not as well.
* Set MARK_EXCESS to 100us and the VS1838 doesn't work at all.
*
* The right value is critical for IR codes using short pulses like Denon / Sharp / Lego
*
* Observed values:
* Delta of each signal type is around 50 up to 100 and at low signals up to 200. TSOP is better, especially at low IR signal level.
* VS1838 Mark Excess -50 to +50 us
@ -98,7 +101,7 @@
*/
#if !defined(MARK_EXCESS_MICROS)
//#define MARK_EXCESS_MICROS 50
#define MARK_EXCESS_MICROS 20 // 20 is recommended for the cheap VS1838 modules
#define MARK_EXCESS_MICROS 20
#endif
/****************************************************
@ -127,7 +130,6 @@
#define PULSE_CORRECTION_NANOS (48000000000L / SYSCLOCK) // 3000 @16MHz, 666 @72MHz
#endif
//------------------------------------------------------------------------------
#include "IRremoteInt.h"
#include "private/IRTimer.cpp.h"
#include "IRFeedbackLED.cpp.h"

View File

@ -57,15 +57,15 @@
* Try to activate it, if you have legacy code to compile with version >= 3
*/
//#define USE_OLD_DECODE // enables the old NEC and other old decoders.
//------------------------------------------------------------------------------
#include "IRProtocol.h"
// All board specific stuff have been moved to its own file, included here.
#include <private/IRBoardDefs.h>
//------------------------------------------------------------------------------
// Information for the Interrupt Service Routine
//
/*
* Information for the Interrupt Service Routine
*/
/**
* Minimum gap between IR transmissions, in microseconds
@ -93,6 +93,10 @@ struct irparams_struct {
// The fields are ordered to reduce memory over caused by struct-padding
volatile uint8_t StateForISR; ///< State Machine state
uint8_t IRReceivePin; ///< Pin connected to IR data from detector
#if defined(__AVR__)
volatile uint8_t *IRReceivePinPortInputRegister;
uint8_t IRReceivePinMask;
#endif
#if RAW_BUFFER_LENGTH <= 255 // saves around 75 bytes program space and speeds up ISR
uint8_t rawlen; ///< counter of entries in rawbuf
#else
@ -123,16 +127,16 @@ struct IRData {
uint16_t address; ///< Decoded address
uint16_t command; ///< Decoded command
uint16_t extra; ///< Used by MagiQuest and for Kaseikyo unknown vendor ID
uint8_t numberOfBits; ///< Number of bits received for data (address + command + parity) - to determine protocol length if different length are possible (currently only Sony).
uint8_t numberOfBits; ///< Number of bits received for data (address + command + parity) - to determine protocol length if different length are possible (currently only Sony).
uint8_t flags; ///< See definitions above
uint32_t decodedRawData; ///< Up to 32 bit decoded raw data, used for sendRaw functions.
irparams_struct *rawDataPtr; /// Pointer of the raw timing data to be decoded. Mainly the data buffer filled by receiving ISR.
};
//#define DEBUG // Activate this for lots of lovely debug output.
//------------------------------------------------------------------------------
// Debug directives
//
/*
* Debug directives
*/
#ifdef DEBUG
# define DBG_PRINT(...) Serial.print(__VA_ARGS__)
# define DBG_PRINTLN(...) Serial.println(__VA_ARGS__)
@ -175,14 +179,13 @@ int getMarkExcessMicros();
* Feedback LED related functions
****************************************************/
void setFeedbackLED(bool aSwitchLedOn);
void LEDFeedback(bool aEnableLEDFeedback);
void setLEDFeedback(uint8_t aFeedbackLEDPin, bool aEnableLEDFeedback); // if aFeedbackLEDPin == 0, then take board BLINKLED_ON() and BLINKLED_OFF() functions
void enableLEDFeedback();
void disableLEDFeedback();
void setFeedbackLEDPin(uint8_t aFeedbackLEDPin); // if 0, then take board BLINKLED_ON() and BLINKLED_OFF() functions
void blink13(bool aEnableLEDFeedback) __attribute__ ((deprecated ("Please use LEDFeedback() or enableLEDFeedback() / disableLEDFeedback."))); // deprecated
void setBlinkPin(uint8_t aFeedbackLEDPin) __attribute__ ((deprecated ("Please use setFeedbackLEDPin()."))); // deprecated
void blink13(bool aEnableLEDFeedback)
__attribute__ ((deprecated ("Please use setLEDFeedback() or enableLEDFeedback() / disableLEDFeedback."))); // deprecated
void setBlinkPin(uint8_t aFeedbackLEDPin) __attribute__ ((deprecated ("Please use setLEDFeedback()."))); // deprecated
/****************************************************
* RECEIVING
@ -223,6 +226,7 @@ public:
IRrecv();
IRrecv(uint8_t aReceivePin);
IRrecv(uint8_t aReceivePin, uint8_t aFeedbackLEDPin);
void setReceivePin(uint8_t aReceivePinNumber);
void enableIRIn();
void disableIRIn();
@ -348,7 +352,8 @@ public:
void begin(uint8_t aSendPin, bool aEnableLEDFeedback = true, uint8_t aFeedbackLEDPin = USE_DEFAULT_FEEDBACK_LED_PIN);
IRsend();
void begin(bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin = USE_DEFAULT_FEEDBACK_LED_PIN) __attribute__ ((deprecated ("Please use begin(<sendPin>, <EnableLEDFeedback>, <LEDFeedbackPin>)")));
void begin(bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin = USE_DEFAULT_FEEDBACK_LED_PIN)
__attribute__ ((deprecated ("Please use begin(<sendPin>, <EnableLEDFeedback>, <LEDFeedbackPin>)")));
size_t write(IRData *aIRSendData, uint_fast8_t aNumberOfRepeats = NO_REPEATS);
@ -461,9 +466,9 @@ extern IRsend IrSender;
* Activate this line if your receiver has an external output driver transistor / "inverted" output
*/
//#define IR_INPUT_IS_ACTIVE_HIGH
//------------------------------------------------------------------------------
// Defines for setting and clearing register bits
//
/*
* Defines for setting and clearing register bits
*/
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
@ -472,12 +477,11 @@ extern IRsend IrSender;
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
//------------------------------------------------------------------------------
// Pulse parms are ((X*50)-100) for the Mark and ((X*50)+100) for the Space.
// First MARK is the one after the long gap
// Pulse parameters in uSec
//
/*
* Pulse parms are ((X*50)-100) for the Mark and ((X*50)+100) for the Space.
* First MARK is the one after the long gap
* Pulse parameters in uSec
*/
/** Relative tolerance (in percent) for some comparisons on measured data. */
#define TOLERANCE 25
@ -498,8 +502,9 @@ extern IRsend IrSender;
#define TICKS_HIGH(us) ((uint16_t) ((long) (us) * UTOL / (MICROS_PER_TICK * 100) + 1))
#endif
//------------------------------------------------------------------------------
// IR receivers on a board with an external output transistor may have "inverted" output
/*
* IR receivers on a board with an external output transistor may have "inverted" output
*/
#ifdef IR_INPUT_IS_ACTIVE_HIGH
// IR detector output is active high
#define MARK 1 ///< Sensor output for a mark ("flash")

View File

@ -84,7 +84,7 @@ void IRsend::sendLGRepeat() {
* There is NO delay after the last sent repeat!
*/
void IRsend::sendLG(uint8_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat) {
uint32_t tRawData = ((uint32_t) aAddress << (LG_COMMAND_BITS + LG_CHECKSUM_BITS)) | (aCommand << LG_CHECKSUM_BITS);
uint32_t tRawData = ((uint32_t) aAddress << (LG_COMMAND_BITS + LG_CHECKSUM_BITS)) | ((uint32_t) aCommand << LG_CHECKSUM_BITS);
/*
* My guess of the checksum
*/

View File

@ -110,7 +110,7 @@ void IRsend::sendLegoPowerFunctions(uint8_t aChannel, uint8_t aCommand, uint8_t
void IRsend::sendLegoPowerFunctions(uint16_t aRawData, uint8_t aChannel, bool aDoSend5Times) {
enableIROut(38);
DBG_PRINT("aRawData=0x");
DBG_PRINT("sendLego aRawData=0x");
DBG_PRINTLN(aRawData, HEX);
aChannel &= 0x03; // we have 4 channels

View File

@ -69,7 +69,7 @@ void IRsend::sendPronto(const uint16_t *data, unsigned int length, uint_fast8_t
}
unsigned int intros = 2 * data[2];
unsigned int repeats = 2 * data[3];
DBG_PRINT(F("intros="));
DBG_PRINT(F("sendPronto intros="));
DBG_PRINT(intros);
DBG_PRINT(F(" repeats="));
DBG_PRINTLN(repeats);

View File

@ -46,7 +46,7 @@ bool sLastSendToggleValue = false;
// see: https://www.sbprojects.net/knowledge/ir/rc5.php
// 0 -> mark+space
// 1 -> space+mark
// MSB first 1 start bit, 1 field bit, 1 toggle bit + 5 bit address + 6 bit command (6 bit command + field bit for RC5X), no stop bit
// MSB first 1 start bit, 1 field bit, 1 toggle bit + 5 bit address + 6 bit command (6 bit command plus one field bit for RC5X), no stop bit
// duty factor is 25%,
//
#define RC5_ADDRESS_BITS 5
@ -248,12 +248,14 @@ bool IRrecv::decodeRC5() {
// R R CCCC 666
//
//
// https://www.sbprojects.net/knowledge/ir/rc6.php
#define MIN_RC6_SAMPLES 1
#define RC6_RPT_LENGTH 46000
#define RC6_LEADING_BIT 1
#define RC6_MODE_BITS 3
#define RC6_MODE_BITS 3 // never seen others than all 0 for Philips TV
#define RC6_TOGGLE_BIT 1
#define RC6_ADDRESS_BITS 8
#define RC6_COMMAND_BITS 8
@ -268,7 +270,7 @@ bool IRrecv::decodeRC5() {
#define RC6_TRAILING_SPACE (6 * RC6_UNIT) // 2666
#define MIN_RC6_MARKS 4 + ((RC6_ADDRESS_BITS + RC6_COMMAND_BITS) / 2) // 12, 4 are for preamble
#define RC6_REPEAT_SPACE 107000 // just a guess
#define RC6_REPEAT_SPACE 107000 // just a guess but > 2.666ms
void IRsend::sendRC6(uint32_t data, uint8_t nbits) {
// Set IR carrier frequency
@ -282,7 +284,7 @@ void IRsend::sendRC6(uint32_t data, uint8_t nbits) {
mark(RC6_UNIT);
space(RC6_UNIT);
// Data
// Data MSB first
uint32_t mask = 1UL << (nbits - 1);
for (uint_fast8_t i = 1; mask; i++, mask >>= 1) {
// The fourth bit we send is a "double width trailer bit"
@ -311,7 +313,7 @@ void IRsend::sendRC6(uint64_t data, uint8_t nbits) {
mark(RC6_UNIT);
space(RC6_UNIT);
// Data
// Data MSB first
uint64_t mask = 1ULL << (nbits - 1);
for (uint_fast8_t i = 1; mask; i++, mask >>= 1) {
// The fourth bit we send is a "double width trailer bit"
@ -358,7 +360,7 @@ void IRsend::sendRC6(uint8_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfR
uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
while (tNumberOfCommands > 0) {
// start bit is sent by sendBiphaseData
// start and leading bits are sent by sendRC6
sendRC6(tIRRawData.ULong, RC6_BITS - 1); // -1 since the leading bit is additionally sent by sendRC6
tNumberOfCommands--;

View File

@ -57,8 +57,9 @@
#define IR_SEND_DUTY_CYCLE 30 // 30 saves power and is compatible to the old existing code
#endif
//------------------------------------------------------------------------------
// microseconds per clock interrupt tick
/**
* microseconds per clock interrupt tick
*/
#if ! defined(MICROS_PER_TICK)
#define MICROS_PER_TICK 50
#endif

View File

@ -106,7 +106,7 @@ struct FeedbackLEDControlStruct FeedbackLEDControl;
/*
* print a warning
*/
#warning No blinking definition found. Check private/IRremoteBoardDefs.h.
#warning No definition for default feedback LED found. Check private/IRFeedbackLEDDefs.h.
#else
/*

View File

@ -206,6 +206,7 @@
# elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define IR_SEND_PIN 11 // Arduino Mega
// MightyCore, MegaCore, MajorCore
# elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \
|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \
|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \
@ -215,7 +216,9 @@
|| defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) \
|| defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) \
|| defined(__AVR_ATmega8515__) || defined(__AVR_ATmega162__)
#define IR_SEND_PIN 13 // MightyCore, MegaCore, MajorCore
# if !defined(IR_SEND_PIN)
#define IR_SEND_PIN 13
#endif
# elif defined(__AVR_ATtiny84__)
# define IR_SEND_PIN 6
@ -228,7 +231,6 @@
#define TIMER_ENABLE_SEND_PWM TCNT1 = 0; (TCCR1A |= _BV(COM1A1))
#define TIMER_DISABLE_SEND_PWM (TCCR1A &= ~(_BV(COM1A1)))
//-----------------
# if defined(__AVR_ATmega8__) || defined(__AVR_ATmega8515__) \
|| defined(__AVR_ATmega8535__) || defined(__AVR_ATmega16__) \
|| defined(__AVR_ATmega32__) || defined(__AVR_ATmega64__) \
@ -688,13 +690,11 @@ void timerConfigForReceive() {
#define TIMER_DISABLE_RECEIVE_INTR NVIC_DISABLE_IRQ(IRQ_CMT)
#define TIMER_INTR_NAME cmt_isr
//-----------------
# ifdef ISR
#undef ISR
# endif
#define ISR(f) void do_not_use__(void)
//-----------------
#define CMT_PPS_DIV ((F_BUS + 7999999) / 8000000)
# if F_BUS < 8000000
#error IRremote requires at least 8 MHz on Teensy 3.x