IoT Node
You'll need to install a library to make Arduino IDE support the module. This library includes drivers for the transceiver and sample code for you to jumpstart your project.
For ESP32 based systems, we're currently supporting Arduino core. Please make sure you've installed the following:
- Arduino IDE.
- ESP32 Hardware libraries for the Arduino IDE.
- Python for the compilation of Arduino projects.
- Drivers for your host device, e.g., USB Virtual Serial Port driver.
Then, copy its contents to your Arduino Libraries folder.
You can find the Arduino Libraries folder inside your Arduino sketch directory. It is generally located inside the My Documents folder.
The library comes with included samples. There is no need to download additional files for the examples.
The hardware, its drivers and the sample code are open source. You can use them under the terms of the MIT license. Please feel free to customize and prototype them for your projects.
Turta_IRRemote_Module library is responsible for encoding and decoding IR remote signals.
To use the library on Arduino IDE, add the following #include statement to the top of your sketch.
#include <Turta_IRRemote_Module.h>
Then, create an instance of the Turta_IRRemote_Module class.
Turta_IRRemote_Module ir
Now you're ready to access the library by calling the ir instance.
To initialize the module, call the begin method.
begin()
This method configures the PWM and INT pins for IR communication.
Configures the driver to listen for incoming IR signals.
void setReception(bool enabled)
Parameters
Bool: enabled Returns
None
Sends 4 Bytes long NEC protocol message.
void sendNECCommand(byte d0, byte d1, byte d2, byte d3)
Parameters
Byte: d0 Byte: d1 Byte: d2 Byte: d3 Returns
None
Returns true if any message is received and ready to be read.
bool isMessageReceived()
Parameters
None Returns
Bool: Message Received State
Reads NEC protocol IR message from the driver buffer.
void getData(byte d0, byte d1, byte d2, byte d3)
Parameters
Byte: d0 out Byte: d1 out Byte: d2 out Byte: d3 out Returns
None
You can open the example from Arduino IDE > File > Examples > Examples from Custom Libraries > Turta IRRemote Module. There are two examples of this sensor.
If you're experiencing difficulties while working with your device, please try the following steps.
Problem: The IR Module does not recognize NEC protocol messages.
Cause: To capture IR messages, the software decoder should be activated.
Solution: Please call setReception(true) method to activate software decoder.
Last modified 3yr ago