# IRremote Arduino Library
Available as Arduino library "IRremote"
### [Version 3.3.0](https://github.com/Arduino-IRremote/Arduino-IRremote/archive/master.zip) - work in progress
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Commits since latest](https://img.shields.io/github/commits-since/Arduino-IRremote/Arduino-IRremote/latest)](https://github.com/Arduino-IRremote/Arduino-IRremote/commits/master)
[![Installation instructions](https://www.ardu-badge.com/badge/IRremote.svg?)](https://www.ardu-badge.com/IRremote)
[![Join the chat at https://gitter.im/Arduino-IRremote/Arduino-IRremote](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Arduino-IRremote/Arduino-IRremote?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![LibraryBuild](https://github.com/Arduino-IRremote/Arduino-IRremote/workflows/LibraryBuild/badge.svg)](https://github.com/Arduino-IRremote/Arduino-IRremote/actions)
This library enables you to send and receive using infra-red signals on an Arduino.
# API
A Doxygen documentation of the sources is available on the [project homepage](https://arduino-irremote.github.io/Arduino-IRremote/).
# Installation
Click on the LibraryManager badge above to see the [instructions](https://www.ardu-badge.com/IRremote/zip).
# Supported IR Protocols
Denon / Sharp, JVC, LG, NEC / Onkyo / Apple, Panasonic / Kaseikyo, RC5, RC6, Samsung, Sony, (Pronto), BoseWave, Lego, Whynter, MagiQuest.<br/>
Protocols can be switched off and on by defining macros before the line `#include <IRremote.h>` like [here](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/SimpleReceiver/SimpleReceiver.ino#L14):
```
#define DECODE_NEC
//#define DECODE_DENON
#include <IRremote.h>
```
# [Wiki](https://github.com/Arduino-IRremote/Arduino-IRremote/wiki)
This is a quite old but maybe useful wiki for this library.
# Features of the 3.x version
- You can use any pin for sending now, like you are used with receiving.
- Simultaneous sending and receiving. See the [UnitTest](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/UnitTest/UnitTest.ino#L165-L166) example.
- No more need to use 32 bit hex values in your code. Instead a (8 bit) command value is provided for decoding (as well as an 16 bit address and a protocol number).
- Protocol values comply to protocol standards, i.e. NEC, Panasonic, Sony, Samsung and JVC decode and send LSB first.
- Supports more protocols, since adding a protocol is quite easy now.
- Better documentation and more examples :-).
- Compatible with tone() library, see [ReceiveDemo](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/ReceiveDemo/ReceiveDemo.ino#L150-L153).
- Supports more platforms, since the new structure allows to easily add a new platform.
- Feedback LED also for sending.
- Ability to generate a non PWM signal to just simulate an active low receiver signal for direct connect to existent receiving devices without using IR.
- Easy configuration of protocols required, directly in your [source code[(https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/SimpleReceiver/SimpleReceiver.ino#L18-L34). This reduces the memory footprint and increases decoding time.
# 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 arbitrary output pins**.<br/>
Therefore you must change all `IrSender.begin(true);` by `IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK);`.
If you use a core that does not use the `-flto` flag for compile, you can activate the line `#define SUPPRESS_ERROR_MESSAGE_FOR_BEGIN` in IRRemote.h, if you get false error messages regarding begin() during compilation.
# 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/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 `results.decode_type` (and similar) to `IrReceiver.decodedIRData.decodedRawData` and `IrReceiver.decodedIRData.protocol`.
- Overflow, Repeat and other flags are now in [`IrReceiver.receivedIRData.flags`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/IRremote.h#L126).
- Seldom used: `results.rawbuf` and `results.rawlen` must be replaced by `IrReceiver.decodedIRData.rawDataPtr->rawbuf` and `IrReceiver.decodedIRData.rawDataPtr->rawlen`.
# Running your 2.x program with the 3.x library version
If you program is like:
```
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
...
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
...
irrecv.resume(); // Receive the next value
}
...
}
```
it should run on the 3.1.1 version as before. The following decoders are available: Denon, JVC, LG, NEC, Panasonic, RC5, RC6, Samsung, Sony.
The `results.value` is set by the decoders for **NEC, Panasonic, Sony, Samsung and JVC** as MSB first like in 2.x.<br/>
- The old functions `sendNEC()` and `sendJVC()` are deprecated and renamed to `sendNECMSB()` and `sendJVCMSB()` to make it clearer that they send data with MSB first, which is not the standard for NEC and JVC. Use them to send your **old MSB-first 32 bit IR data codes**.
In the new version you will send NEC commands not by 32 bit codes but by a (constant) 8 bit address and an 8 bit command.
# Convert old MSB first 32 bit IR data codes to new LSB first 32 bit IR data codes
The new decoders for **NEC, Panasonic, Sony, Samsung and JVC** `IrReceiver.decodedIRData.decodedRawData` is now LSB-first, as the definition of these protocols suggests!
To convert one into the other, you must reverse the byte positions and then reverse all bit positions of each byte or write it as one binary string and reverse/mirror it.<br/>
Example:<br/>
0xCB340102 byte reverse -> 02 01 34 CB bit reverse-> 40 80 2C D3.<br/>
0xCB340102 is binary 11001011001101000000000100000010.<br/>
0x40802CD3 is binary 01000000100000000010110011010011.<br/>
If you read the first binary sequence backwards (right to left), you get the second sequence.
# FAQ
- IR does not work right when I use **Neopixels** (aka WS2811/WS2812/WS2812B) or other libraries blocking interrupts for a longer time (> 50 us).<br/>
Whether you use the Adafruit Neopixel lib, or FastLED, interrupts get disabled on many lower end CPUs like the basic Arduinos for longer than 50 �s.
In turn, this stops the IR interrupt handler from running when it needs to. There are some solutions to this on some processors,
[see this page from Marc MERLIN](http://marc.merlins.org/perso/arduino/post_2017-04-03_Arduino-328P-Uno-Teensy3_1-ESP8266-ESP32-IR-and-Neopixels.html)
- The default IR timer on AVR's is timer 2. Since the **Arduino Tone library** as well as **analogWrite() for
没有合适的资源?快使用搜索试试~ 我知道了~
IRremote-3.3.0库
共81个文件
h:30个
ino:19个
cpp:16个
需积分: 40 19 下载量 193 浏览量
2022-04-21
16:18:24
上传
评论
收藏 286KB ZIP 举报
温馨提示
IRremote-3.3.0库
资源详情
资源评论
资源推荐
收起资源包目录
IRremote-3.3.0.zip (81个子文件)
IRremote-3.3.0
changelog.md 8KB
library.json 670B
keywords.txt 1KB
Doxyfile 107KB
src
ir_BoseWave.cpp 5KB
ir_LG.cpp 11KB
ir_Whynter.cpp 3KB
ir_NEC.cpp 14KB
IRremote.h 9KB
IRReceive.cpp.h 51KB
TinyIRReceiver.cpp.h 15KB
ir_Pronto.cpp 12KB
private
IRFeedbackLEDDefs.h 3KB
IRTimer.cpp.h 46KB
IRProtocol.h 3KB
IRremoteInt.h 22KB
ir_JVC.cpp 10KB
LongUnion.h 2KB
IRSend.cpp.h 17KB
IRFeedbackLED.cpp.h 5KB
ir_Kaseikyo.cpp 12KB
ir_RC5_RC6.cpp 19KB
ir_Template.cpp 9KB
ir_Denon.cpp 10KB
ir_MagiQuest.cpp 5KB
ir_Dish.cpp 2KB
ir_DistanceProtocol.cpp 10KB
ir_Sony.cpp 9KB
digitalWriteFast.h 19KB
ir_Lego.cpp 9KB
TinyIRReceiver.h 5KB
ir_Samsung.cpp 11KB
library.properties 1KB
pictures
IR_PWM_by_software_detail.png 20KB
IR_PWM_by_software_jitter.png 24KB
examples
ReceiveDemo
IRremote_SendDemo_ReceiveDemo.log 6KB
PinDefinitionsAndMore.h 8KB
ReceiveDemo.ino 7KB
UnitTest
UnitTest.ino 16KB
PinDefinitionsAndMore.h 8KB
UnitTest.log 5KB
SendLGAirConditionerDemo
SendLGAirConditionerDemo.ino 8KB
Readme.md 4KB
PinDefinitionsAndMore.h 8KB
SendAndReceive
SendAndReceive.log 1KB
PinDefinitionsAndMore.h 8KB
SendAndReceive.ino 6KB
ReceiveAndSend
PinDefinitionsAndMore.h 8KB
ReceiveAndSend.ino 7KB
SendProntoDemo
PinDefinitionsAndMore.h 8KB
SendProntoDemo.ino 5KB
ReceiverTimingAnalysis
ReceiverTimingAnalysis.ino 8KB
MicroGirs
MicroGirs.ino 12KB
SendDemo
SendDemo.ino 10KB
IRremote_SendDemo_ReceiveDemo.log 6KB
PinDefinitionsAndMore.h 8KB
IRremoteInfo
IRremoteInfo.ino 10KB
SendBoseWaveDemo
PinDefinitionsAndMore.h 8KB
SendBoseWaveDemo.ino 7KB
IRremoteExtensionTest
IRremoteExtensionTest.ino 1KB
IRremoteExtensionClass.h 2KB
PinDefinitionsAndMore.h 8KB
SimpleSender
SimpleSender.ino 2KB
PinDefinitionsAndMore.h 8KB
ControlRelay
ControlRelay.ino 4KB
PinDefinitionsAndMore.h 8KB
IRDispatcherDemo
IRCommandDispatcher.cpp.h 10KB
IRDispatcherDemo.ino 9KB
IRCommandDispatcher.h 3KB
IRCommandMapping.h 5KB
SimpleReceiver
SimpleReceiver.ino 3KB
PinDefinitionsAndMore.h 8KB
MinimalReceiver
MinimalReceiver.ino 4KB
ReceiveDump
PinDefinitionsAndMore.h 8KB
ReceiveDump.ino 6KB
SendRawDemo
PinDefinitionsAndMore.h 8KB
SendRawDemo.ino 6KB
README.md 31KB
Contributing.md 1KB
Contributors.md 2KB
LICENSE.txt 1KB
共 81 条
- 1
hongboy8899
- 粉丝: 3
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0