Close

IR Remote Library for Arduino

A project log for Open Universal Remote (OUR)

Under $10 open source Universal Remote. Bluetooth to IR bridge with ESP32.

sandeep-patilSandeep Patil 01/11/2017 at 12:550 Comments

There is a very good IR Remote library for Arduino. This works with most controllers that work with Arduino. ESP32 has built-in remote peripheral. The library uses a timer and an interrupt pin to accomplish send and receiving IR signals. With ESP32 this can be done with the built-in Remote peripheral. Since the approach is entirely different it will be difficult to port the same library for ESP32. I have started writing one for the ESP32. The NEC encoding is working well.

#include "esp32_rmt.h"
ESP32_RMT rem1, rem2;
uint8_t cnt;
uint16_t cmd, addr;
 
void setup() 
{ 
  rem1.begin(17,1);
  rem2.begin(16,1);
  Serial.begin(115200);
  Serial.println("Enter Commands");
  
}

void loop() 
{
  

     if(Serial.available()>0)
     {
        switch(Serial.read())
        {
          case '0': Serial.println("power"); rem2.necSend(0x3000, 0xfd02); break;
          case '1': Serial.println("volume up"); rem2.necSend(0x3000, 0x7d82); break;
          case '2': Serial.println("volume down"); rem2.necSend(0x3000, 0x7c83); break;
          default: break;
        }
      
     }
}

This is my first port of Arduino Library, let's see how it goes. Any constructive feedback is much appreciated.

https://github.com/ExploreEmbedded/ESP32_RMT

Discussions