Clone IR Remote for Arduino Projects (IRlib2)

Hello Gang!

I am trying to clone the IR signal of consumer electronics to give IR control to my Arduino.
(I wish to give the Arduino the ability to turn on and off a TV)
This seems simple enough, and there are several tutorials online, so, easy, right?

I’ve found several examples of how to copy the IR signal into the Serial Monitor my problem is re-transmitting them with my IR Led from my arduino.

Demo Hardware:

My breadboard example:
I’m using an detector to collect the IR signals, and a 940nm IR LED to transmit.

Most of the tutorials I find on the internet are based on outdated IR Libraries.
(I don’t mind this, as long as I can get them to work)

After failing to transmit the captured codes from my IR Led I tired the examples from the new IRlib2 library.

I’ve tried the “rawRecv” example sketch and successfully captured the timing data.

/* rawR&cv.ino Example sketch for IRLib2
 *  Illustrate how to capture raw timing values for an unknow protocol.
 *  You will capture a signal using this sketch. It will output data the 
 *  serial monitor that you can cut and paste into the "rawSend.ino"
 *  sketch.
 */
// Recommend only use IRLibRecvPCI or IRLibRecvLoop for best results
#include <IRLibRecvPCI.h> 

IRrecvPCI myReceiver(2);//pin number for the receiver

void setup() {
  Serial.begin(9600);
  delay(2000); while (!Serial); //delay for Leonardo
  myReceiver.enableIRIn(); // Start the receiver
  Serial.println(F("Ready to receive IR signals"));
}

void loop() {
  //Continue looping until you get a complete signal received
  if (myReceiver.getResults()) { 
    Serial.println(F("Do a cut-and-paste of the following lines into the "));
    Serial.println(F("designated location in rawSend.ino"));
    Serial.print(F("\n#define RAW_DATA_LEN "));
    Serial.println(recvGlobal.recvLength,DEC);
    Serial.print(F("uint16_t rawData[RAW_DATA_LEN]={\n\t"));
    for(bufIndex_t i=1;i<recvGlobal.recvLength;i++) {
      Serial.print(recvGlobal.recvBuffer[i],DEC);
      Serial.print(F(", "));
      if( (i % 8)==0) Serial.print(F("\n\t"));
    }
    Serial.println(F("1000};"));//Add arbitrary trailing space
    myReceiver.enableIRIn();      //Restart receiver

I get this code from my samsung remote:

Do a cut-and-paste of the following lines into the 
designated location in rawSend.ino

#define RAW_DATA_LEN 68
uint16_t rawData[RAW_DATA_LEN]={
	4530, 4514, 562, 1686, 562, 1682, 566, 1682, 
	562, 590, 534, 590, 534, 590, 534, 590, 
	534, 590, 534, 1686, 558, 1686, 562, 1686, 
	562, 590, 534, 590, 534, 590, 530, 594, 
	530, 594, 530, 590, 534, 1686, 562, 590, 
	534, 590, 534, 590, 534, 590, 534, 594, 
	526, 594, 530, 1686, 562, 590, 534, 1690, 
	558, 1682, 562, 1686, 562, 1686, 562, 1686, 
	562, 1682, 562, 1000};

Here is the ‘rawSend’ example sketch:

/* rawSend.ino Example sketch for IRLib2
 *  Illustrates how to send a code Using raw timings which were captured
 *  from the "rawRecv.ino" sample sketch.  Load that sketch and
 *  capture the values. They will print in the serial monitor. Then you
 *  cut and paste that output into the appropriate section below.
 */
#include <IRLibSendBase.h>    //We need the base code
#include <IRLib_HashRaw.h>    //Only use raw sender

IRsendRaw mySender;

void setup() {
  Serial.begin(9600);
  delay(2000); while (!Serial); //delay for Leonardo
  Serial.println(F("Every time you press a key is a serial monitor we will send."));
}
/* Cut and paste the output from "rawRecv.ino" below here. It will 
 * consist of a #define RAW_DATA_LEN statement and an array definition
 * beginning with "uint16_t rawData[RAW_DATA_LEN]= {…" and concludes
 * with "…,1000};"
 */





/*
 * Cut-and-paste into the area above.
 */
   
void loop() {
  if (Serial.read() != -1) {
    //send a code every time a character is received from the 
    // serial port. You could modify this sketch to send when you
    // push a button connected to an digital input pin.
    mySender.send(rawData,RAW_DATA_LEN,36);//Pass the buffer,length, optionally frequency
    Serial.println(F("Sent signal."));
  }
}

Hardware

I’m using a 940nm IR LED driven by a 2222a BJT.
I used the diagram from a tutorial that used a 4.6K resistor on the base.
(should I have a current limiter for the IR LED?)

Here is my question:

After I paste the timing code into “rawSend” How do I code the LED to turn on and off with the appropriate timing?

I’ve tried many tutorials I found online, but perhaps because they use a different library, I’m not having success.

I’ve tried examples like these:

Clone IR Signals with Arduino

Adafruit IR Library example

Using IR commands to control consumer electronics is something I’d like to use a lot once I figure it out.
Any tips would be greatly appreciated!

Thanks!

(should I have a current limiter for the IR LED?)

Yes, without a current limit resistor the transistor and/or LED will be damaged. Can't comment on current limit resistor value without seeing the LED data sheet and knowing the supply voltage. You may need to reduce the base resistor value to get the collector current required. Have you confirmed that the LED is actually emitting IR by using a cell phone camera to view the LED?

Have you turned off 'line endings' in Serial Monitor? If not, you are going to receive two or more characters very quickly and the back-to-back outputs may confuse receiving hardware. Perhaps a delay of 200 milliseconds after each send would help. Couldn't hurt to try.

groundFungus:
Yes, without a current limit resistor the transistor and/or LED will be damaged. Can't comment on current limit resistor value without seeing the LED data sheet and knowing the supply voltage. You may need to reduce the base resistor value to get the collector current required.

Hello groundFungus!
Here is the link to the purchase page:
https://www.amazon.com/gp/product/B00EFOQEUM/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1
Unfortunately no datasheet for the LEDs, but the comments suggested 220 ohm or higher, so I've started using one.

groundFungus:
Have you confirmed that the LED is actually emitting IR by using a cell phone camera to view the LED?

Yes, I also watched the intensity to get an idea about the value of the current limiting resistor.
Thank you for the suggestion!

johnwasser:
Have you turned off 'line endings' in Serial Monitor? If not, you are going to receive two or more characters very quickly and the back-to-back outputs may confuse receiving hardware. Perhaps a delay of 200 milliseconds after each send would help. Couldn't hurt to try.

Thanks johnwasser
I will try it.
Can you suggest example of code I should use?

The problem I've been having is that I can't get compatible capture and transmit code pairs.
I've seen good examples of each, but the transmit method has to coordinate with how the raw capture works.

I realize after I posted this question that there are SEVERAL ways to accomplish the task of sending IR signals to a device.
(I found this out after I started researching it!)

So I am going to be more clear about what my objectives are, that should distil the options down to what my needs are specifically.

Objectives:

1) Arduino hardware:
As stated in the topic description, I wish to use this in my Arduino projects.
(I have one started that I'm stuck on, but also I will need this ability for future Arduino projects)

2) Protocol agnostic:
Since I wish to use this method with all sorts of IR devices, I like the idea of collecting "raw" data from the remote pointed at the IR receiver and simply recording the pulse data.
This should work with any remote!

I'm aware that reverse engineering manufacturer protocols has it's benefits, especially if I wish to send multiple signals.
However, to just turn on a power button here or there this seems overkill, and will complicate my sketch.

3) Simple is best!
(for now)
If I can get away with a string of 'High' and 'Low' timings instead of evoking serial communication, or extra libraries, I'm all for it!

Is there a simple way to just record the "ON" and "OFF" times and blink the LED with direct code?
(this would require a different capture technique or some translation it seems?)

Once I am confident, and get this up and running, I am willing to try more complex methods to learn.

Any tips would be most welcome!
Thanks!

I’ve hit a programming wall!

Desperate to follow all of the tutorials published with the older libraries, I decide to load
the library based on the work of Ken Shirriff.

I’ve passed on this before in favor of the newer IRLib2, however, since I’m not finding tutorials on this new library, I decided to go ahead and install the “Arduino-IRremote-master library”

I am not trying out the capture example, and immediately the IDE encounters an error in compiling “IRrercevDump”.
Undeterred, I try the seemingly updated “IRrecevDumpV2” = same error:
‘class decode_results’ has no member named ‘address’

Here is the complete sketches in case you do not have the library installed with examples.

ERrecevDump Example sketch

/*
 * IRremote: IRrecvDump - dump details of IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 * JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
 * LG added by Darryl Smith (based on the JVC protocol)
 */

#include <IRremote.h>

/* 
*  Default is Arduino pin D11. 
*  You can change this to another available Arduino Pin.
*  Your IR receiver should be connected to the pin defined here
*/
int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}


void dump(decode_results *results) {
  // Dumps out the decode_results structure.
  // Call this after IRrecv::decode()
  int count = results->rawlen;
  if (results->decode_type == UNKNOWN) {
    Serial.print("Unknown encoding: ");
  }
  else if (results->decode_type == NEC) {
    Serial.print("Decoded NEC: ");

  }
  else if (results->decode_type == SONY) {
    Serial.print("Decoded SONY: ");
  }
  else if (results->decode_type == RC5) {
    Serial.print("Decoded RC5: ");
  }
  else if (results->decode_type == RC6) {
    Serial.print("Decoded RC6: ");
  }
  else if (results->decode_type == PANASONIC) {
    Serial.print("Decoded PANASONIC - Address: ");
    Serial.print(results->address, HEX);
    Serial.print(" Value: ");
  }
  else if (results->decode_type == LG) {
    Serial.print("Decoded LG: ");
  }
  else if (results->decode_type == JVC) {
    Serial.print("Decoded JVC: ");
  }
  else if (results->decode_type == AIWA_RC_T501) {
    Serial.print("Decoded AIWA RC T501: ");
  }
  else if (results->decode_type == WHYNTER) {
    Serial.print("Decoded Whynter: ");
  }
  Serial.print(results->value, HEX);
  Serial.print(" (");
  Serial.print(results->bits, DEC);
  Serial.println(" bits)");
  Serial.print("Raw (");
  Serial.print(count, DEC);
  Serial.print("): ");

  for (int i = 1; i < count; i++) {
    if (i & 1) {
      Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
    }
    else {
      Serial.write('-');
      Serial.print((unsigned long) results->rawbuf[i]*USECPERTICK, DEC);
    }
    Serial.print(" ");
  }
  Serial.println();
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    dump(&results);
    irrecv.resume(); // Receive the next value
  }
}

IRrecevDumpV2 example sketch:

//------------------------------------------------------------------------------
// Include the IRremote library header
//
#include <IRremote.h>

//------------------------------------------------------------------------------
// Tell IRremote which Arduino pin is connected to the IR Receiver (TSOP4838)
//
int recvPin = 11;
IRrecv irrecv(recvPin);

//+=============================================================================
// Configure the Arduino
//
void  setup ( )
{
  Serial.begin(9600);   // Status message will be sent to PC at 9600 baud
  irrecv.enableIRIn();  // Start the receiver
}

//+=============================================================================
// Display IR code
//
void  ircode (decode_results *results)
{
  // Panasonic has an Address
  if (results->decode_type == PANASONIC) {
    Serial.print(results->address, HEX);
    Serial.print(":");
  }

  // Print Code
  Serial.print(results->value, HEX);
}

//+=============================================================================
// Display encoding type
//
void  encoding (decode_results *results)
{
  switch (results->decode_type) {
    default:
    case UNKNOWN:      Serial.print("UNKNOWN");       break ;
    case NEC:          Serial.print("NEC");           break ;
    case SONY:         Serial.print("SONY");          break ;
    case RC5:          Serial.print("RC5");           break ;
    case RC6:          Serial.print("RC6");           break ;
    case DISH:         Serial.print("DISH");          break ;
    case SHARP:        Serial.print("SHARP");         break ;
    case JVC:          Serial.print("JVC");           break ;
    case SANYO:        Serial.print("SANYO");         break ;
    case MITSUBISHI:   Serial.print("MITSUBISHI");    break ;
    case SAMSUNG:      Serial.print("SAMSUNG");       break ;
    case LG:           Serial.print("LG");            break ;
    case WHYNTER:      Serial.print("WHYNTER");       break ;
    case AIWA_RC_T501: Serial.print("AIWA_RC_T501");  break ;
    case PANASONIC:    Serial.print("PANASONIC");     break ;
    case DENON:        Serial.print("Denon");         break ;
  }
}

//+=============================================================================
// Dump out the decode_results structure.
//
void  dumpInfo (decode_results *results)
{
  // Check if the buffer overflowed
  if (results->overflow) {
    Serial.println("IR code too long. Edit IRremoteInt.h and increase RAWBUF");
    return;
  }

  // Show Encoding standard
  Serial.print("Encoding  : ");
  encoding(results);
  Serial.println("");

  // Show Code & length
  Serial.print("Code      : ");
  ircode(results);
  Serial.print(" (");
  Serial.print(results->bits, DEC);
  Serial.println(" bits)");
}

//+=============================================================================
// Dump out the decode_results structure.
//
void  dumpRaw (decode_results *results)
{
  // Print Raw data
  Serial.print("Timing[");
  Serial.print(results->rawlen-1, DEC);
  Serial.println("]: ");

  for (int i = 1;  i < results->rawlen;  i++) {
    unsigned long  x = results->rawbuf[i] * USECPERTICK;
    if (!(i & 1)) {  // even
      Serial.print("-");
      if (x < 1000)  Serial.print(" ") ;
      if (x < 100)   Serial.print(" ") ;
      Serial.print(x, DEC);
    } else {  // odd
      Serial.print("     ");
      Serial.print("+");
      if (x < 1000)  Serial.print(" ") ;
      if (x < 100)   Serial.print(" ") ;
      Serial.print(x, DEC);
      if (i < results->rawlen-1) Serial.print(", "); //',' not needed for last one
    }
    if (!(i % 8))  Serial.println("");
  }
  Serial.println("");                    // Newline
}

//+=============================================================================
// Dump out the decode_results structure.
//
void  dumpCode (decode_results *results)
{
  // Start declaration
  Serial.print("unsigned int  ");          // variable type
  Serial.print("rawData[");                // array name
  Serial.print(results->rawlen - 1, DEC);  // array size
  Serial.print("] = {");                   // Start declaration

  // Dump data
  for (int i = 1;  i < results->rawlen;  i++) {
    Serial.print(results->rawbuf[i] * USECPERTICK, DEC);
    if ( i < results->rawlen-1 ) Serial.print(","); // ',' not needed on last one
    if (!(i & 1))  Serial.print(" ");
  }

  // End declaration
  Serial.print("};");  // 

  // Comment
  Serial.print("  // ");
  encoding(results);
  Serial.print(" ");
  ircode(results);

  // Newline
  Serial.println("");

  // Now dump "known" codes
  if (results->decode_type != UNKNOWN) {

    // Some protocols have an address
    if (results->decode_type == PANASONIC) {
      Serial.print("unsigned int  addr = 0x");
      Serial.print(results->address, HEX);
      Serial.println(";");
    }

    // All protocols have data
    Serial.print("unsigned int  data = 0x");
    Serial.print(results->value, HEX);
    Serial.println(";");
  }
}

//+=============================================================================
// The repeating section of the code
//
void  loop ( )
{
  decode_results  results;        // Somewhere to store the results

  if (irrecv.decode(&results)) {  // Grab an IR code
    dumpInfo(&results);           // Output the results
    dumpRaw(&results);            // Output the results in RAW format
    dumpCode(&results);           // Output the results as source code
    Serial.println("");           // Blank line between entries
    irrecv.resume();              // Prepare for the next value
  }
}

Any advice on how to get arround this?

Thanks!

The screen captures are too small to read. Please use the "Copy error messages" button and paste the messages here in code tags.

I have the IRremote library (V2.0.1) installed through Sketch->Include Library->Manage libraries. The example IRrecvDumpV2 compiles fine for me. I suspect that something went wrong with the installation.

johnwasser:
The screen captures are too small to read. Please use the “Copy error messages” button and paste the messages here in code tags.

I have the IRremote library (V2.0.1) installed through Sketch->Include Library->Manage libraries. The example IRrecvDumpV2 compiles fine for me. I suspect that something went wrong with the installation.

Sure, here is the IRrecvDump:

Arduino: 1.8.3 (Windows Store 1.8.6.0) (Windows 10), Board: "Arduino Nano, ATmega328"

C:\Users\Josh\Dropbox\INFO\ELECTRONICS\Electronics Programs\Arduino\libraries\Arduino-IRremote-master\examples\IRrecvDump\IRrecvDump.ino: In function 'void dump(decode_results*)':

IRrecvDump:53: error: 'class decode_results' has no member named 'address'

     Serial.print(results->address, HEX);

                           ^

IRrecvDump:56: error: 'LG' was not declared in this scope

   else if (results->decode_type == LG) {

                                    ^

IRrecvDump:62: error: 'AIWA_RC_T501' was not declared in this scope

   else if (results->decode_type == AIWA_RC_T501) {

                                    ^

IRrecvDump:65: error: 'WHYNTER' was not declared in this scope

   else if (results->decode_type == WHYNTER) {

                                    ^

Multiple libraries were found for "IRremote.h"
 Used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.6.0_x64__mdqgnx93n4wtt\libraries\RobotIRremote
 Not used: C:\Users\Josh\Dropbox\INFO\ELECTRONICS\Electronics Programs\Arduino\libraries\Arduino-IRremote-master
exit status 1
'class decode_results' has no member named 'address'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

And Here is the IRrecvDumpV2:

Arduino: 1.8.3 (Windows Store 1.8.6.0) (Windows 10), Board: "Arduino Nano, ATmega328"

C:\Users\Josh\Dropbox\INFO\ELECTRONICS\Electronics Programs\Arduino\libraries\Arduino-IRremote-master\examples\IRrecvDumpV2\IRrecvDumpV2.ino: In function 'void ircode(decode_results*)':

IRrecvDumpV2:28: error: 'class decode_results' has no member named 'address'

     Serial.print(results->address, HEX);

                           ^

C:\Users\Josh\Dropbox\INFO\ELECTRONICS\Electronics Programs\Arduino\libraries\Arduino-IRremote-master\examples\IRrecvDumpV2\IRrecvDumpV2.ino: In function 'void encoding(decode_results*)':

IRrecvDumpV2:53: error: 'SAMSUNG' was not declared in this scope

     case SAMSUNG:      Serial.print("SAMSUNG");       break ;

          ^

IRrecvDumpV2:54: error: 'LG' was not declared in this scope

     case LG:           Serial.print("LG");            break ;

          ^

IRrecvDumpV2:55: error: 'WHYNTER' was not declared in this scope

     case WHYNTER:      Serial.print("WHYNTER");       break ;

          ^

IRrecvDumpV2:56: error: 'AIWA_RC_T501' was not declared in this scope

     case AIWA_RC_T501: Serial.print("AIWA_RC_T501");  break ;

          ^

IRrecvDumpV2:58: error: 'DENON' was not declared in this scope

     case DENON:        Serial.print("Denon");         break ;

          ^

C:\Users\Josh\Dropbox\INFO\ELECTRONICS\Electronics Programs\Arduino\libraries\Arduino-IRremote-master\examples\IRrecvDumpV2\IRrecvDumpV2.ino: In function 'void dumpInfo(decode_results*)':

IRrecvDumpV2:68: error: 'class decode_results' has no member named 'overflow'

   if (results->overflow) {

                ^

C:\Users\Josh\Dropbox\INFO\ELECTRONICS\Electronics Programs\Arduino\libraries\Arduino-IRremote-master\examples\IRrecvDumpV2\IRrecvDumpV2.ino: In function 'void dumpCode(decode_results*)':

IRrecvDumpV2:152: error: 'class decode_results' has no member named 'address'

       Serial.print(results->address, HEX);

                             ^

Multiple libraries were found for "IRremote.h"
 Used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.6.0_x64__mdqgnx93n4wtt\libraries\RobotIRremote
 Not used: C:\Users\Josh\Dropbox\INFO\ELECTRONICS\Electronics Programs\Arduino\libraries\Arduino-IRremote-master
exit status 1
'class decode_results' has no member named 'address'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

In the mean time I’ve been working on the new library files (In my first post)

I have been successful in capturing consistent codes from the IRlib2 examples.
First I used the “rawRecv” in the first post, I coppied the timing and script over to the “rawSend”

The result is:

/* rawSend.ino Example sketch for IRLib2
 *  Illustrates how to send a code Using raw timings which were captured
 *  from the "rawRecv.ino" sample sketch.  Load that sketch and
 *  capture the values. They will print in the serial monitor. Then you
 *  cut and paste that output into the appropriate section below.
 */
#include <IRLibSendBase.h>    //We need the base code
#include <IRLib_HashRaw.h>    //Only use raw sender

IRsendRaw mySender;

void setup() {
  Serial.begin(9600);
  delay(2000); while (!Serial); //delay for Leonardo
  Serial.println(F("Every time you press a key is a serial monitor we will send."));
}
/* Cut and paste the output from "rawRecv.ino" below here. It will 
 * consist of a #define RAW_DATA_LEN statement and an array definition
 * beginning with "uint16_t rawData[RAW_DATA_LEN]= {…" and concludes
 * with "…,1000};"
 */

#define RAW_DATA_LEN 26
uint16_t rawData[RAW_DATA_LEN]={
  2430, 602, 1162, 638, 562, 634, 1162, 638, 
  538, 658, 1166, 634, 538, 662, 562, 634, 
  1166, 634, 538, 662, 538, 658, 538, 662, 
  538, 1000};


/*
 * Cut-and-paste into the area above.
 */
   
void loop() {
  if (Serial.read() != -1) {
    //send a code every time a character is received from the 
    // serial port. You could modify this sketch to send when you
    // push a button connected to an digital input pin.
    mySender.send(rawData,RAW_DATA_LEN,36);//Pass the buffer,length, optionally frequency
    Serial.println(F("Sent signal."));
  }
}

How hard would it be to translate this code into the IR LED output?
It seems I’m 90% there, and all of the hard parts are finished.
The comments in the code even say:

You could modify this sketch to send when you
// push a button connected to an digital input pin.

My problem is that I don’t understand WHERE this code is “sending” the signal to.

Can anyone tell me how to “send” to the LED with this code?
(and trigger it with a button)
Or Am I wrong about this being possible?

Do you have to be an expert at the library to make it work?

joshsstuff:
Sure, here is the IRrecvDump:

Arduino: 1.8.3 (Windows Store 1.8.6.0) (Windows 10), Board: "Arduino Nano, ATmega328"

C:\Users\Josh\Dropbox\INFO\ELECTRONICS\Electronics Programs\Arduino\libraries\Arduino-IRremote-master\examples\IRrecvDump\IRrecvDump.ino: In function 'void dump(decode_results*)':

IRrecvDump:53: error: 'class decode_results' has no member named 'address'

Serial.print(results->address, HEX);

Try renaming the directory:
C:\Users\Josh\Dropbox\INFO\ELECTRONICS\Electronics Programs\Arduino\libraries\Arduino-IRremote-master
to
C:\Users\Josh\Dropbox\INFO\ELECTRONICS\Electronics Programs\Arduino\libraries\IRremote\

Then you have to re-start the IDE to pick up the new library location.

It looks like you downloaded directly from github and expanded the file into a directory. You are more likely to get correct results if you can install using Library Manager (Sketch->Include Library->Manage Libraries...). It is not clear if the "Arduino" directory is your sketch directory (which it should be) or your installation directory (where the Arduino IDE is installed). You should not install anything manually in the Arduino installation directories.

If renaming the directory doesn't fix the problem you will have to track down what old version of IRremote.h your compiler is finding and delete that old installation. It may be the IRremote library that Arduino included for the (now obsolete) Arduino Robot. Unless you have one of those old robots you can delete the three libraries for it.

johnwasser:
Try renaming the directory:
C:\Users\Josh\Dropbox\INFO\ELECTRONICS\Electronics Programs\Arduino\libraries\Arduino-IRremote-master
to
C:\Users\Josh\Dropbox\INFO\ELECTRONICS\Electronics Programs\Arduino\libraries\IRremote\

Good Catch!

I had both the Windows 10 App and the x86 IDE installed.
I removed the X86 IDE and deleted IRrobot library.

Thanks johnwasser!

I found an awesome video that explains every step!
The only catch is that he is using a computer to send the IR pulse codes through the Com of the Arduino.

Arduino Home Automation

I’m going to copy his project, if it works, I’ll modify it to send from the Arduino.

His code: (for both capture and send)

#include <IRremote.h>

IRrecv receiver(2); // receiver is connected to pin2
IRsend sender;
decode_results results;

long repetitions;
long count;
unsigned int durations[100];
void (*reset)(void) = 0;

void setup() {
  Serial.begin(9600);
  receiver.enableIRIn(); // start receiving signals
}

void loop() {

  // check for text from the PC
  // the PC sends a string containing "r,n,a,b,c,d,e,..." where r is how many times to repeat the command,
  // n is the number of durations, and a/b/c/d/e/... are the durations.
  // the durations are how long each mark and space period of an infrared command should last, in microseconds.
  if(Serial.available()) {

    // parse the text
    repetitions = Serial.parseInt();
    count = Serial.parseInt();
    for(int i = 0; i < count; i++)
      durations[i] = Serial.parseInt();

    // send the command using 40kHz PWM
    for(int i = 0; i < repetitions; i++) {
      sender.sendRaw(durations, count, 40);
      delay(50);
    }

    // for a bit of fault tolerance, reset the arduino after receiving any command
    reset();
    
  }

  // check if a decoded infrared signal is available
  if(receiver.decode(&results)) {
    Serial.println(results.value, HEX);
    Serial.print(results.rawlen - 1);
    for(int i = 1; i < results.rawlen; i++) {
      unsigned int number = results.rawbuf[i] * USECPERTICK;
      Serial.print(",");
      Serial.print(number);
    }
    Serial.println("");
    receiver.resume();
  }
  
}