Go Down

Topic: IRRemote library, sending DVD codes. (Read 668 times) previous topic - next topic

stoopkid

I'm using this library to send some commands to my DVD player. I've been able to use the library to recognize codes, I had an RC car controlled by a TV remote. But sending codes I don't quite get. I just need to send the power code and play code.

This is what the IRrecDump sketch gives me for the power button:
Quote
E144827D
Decoded NEC: E144827D (32 bits)
Raw (68): 3236 9150 -4450 600 -1650 650 -1650 600 -1650 600 -500 650 -500 600 -500 600 -500 650 -1650 600 -500 600 -1650 650 -500 600 -500 600 -500 650 -1650 600 -500 600 -500 650 -1600 650 -500 600 -500 650 -500 600 -500 600 -500 650 -1650 600 -500 600 -500 650 -1650 600 -1650 600 -1650 650 -1600 650 -1650 600 -500 600 -1650 650

and the play button:
Quote
E1447A85
Decoded NEC: E1447A85 (32 bits)
Raw (68): -15260 9150 -4450 650 -1600 650 -1600 650 -1650 650 -450 650 -450 650 -500 650 -450 650 -1600 650 -500 650 -1600 650 -450 650 -500 650 -450 650 -1600 650 -500 650 -450 650 -500 600 -1650 650 -1600 650 -1600 700 -1600 600 -500 650 -1600 650 -500 600 -1650 650 -450 650 -500 600 -500 650 -450 650 -1650 600 -500 650 -1600 650


I'm not sure if I need to keep track of all those numbers or if I can just use the hex code. When I made the RC car I just used the decoded number in decimal form. I've been trying lots of stuff but so far nothing seems to work.

Thanks

pylon

This is adapted from the example code and sends the power and play button with 1 second delay in between.

Code: [Select]
#include <IRremote.h>

IRsend irsend;

void setup()
{
}

void loop() {
  int i;
  for (i = 0; i < 3; i++) {
    irsend.sendNEC(0xE144827D, 32); // Power button
  }
  delay(1000);
  for (i = 0; i < 3; i++) {
    irsend.sendNEC(0xE1447A85, 32); // Play button
  }
  delay(1000);
}

stoopkid

Thanks.
I was a bit confused by that example code. Is there already a defined pin for the output? Or do I still need to define one?

pylon

Yes, there is. On the UNO it's pin 3 (it has to be a PWM output pin of timer 2).

stoopkid

Aha! Thank you. Next time I will consider spending a few minutes reading instead of hours of trial and error... Maybe.

Go Up