I'm trying to program my Arduino Mega to power on/off a Proscan TV using a MagicW Digital 38khz receiver and transmitter modules. I don't have the original remote for the TV, but I was able to program my Harmony remote as one, which has a "toggle" power (no dedicated on/off) and it works just fine. I set up the IR receiver module on my Mega and recorded the power button. In the serial monitor it came back with the hex code E0E040BF - 3 times in a row).
I created a sketch containing the following commands:
When the TV is already powered on, the commands successfully turn it off. But when the TV is off, the commands won't turn it back on. What's weird is the Harmony remote, which consistently gives me the same hex code 3 times when used with the receiver, works just fine. I've tried altering the delay, from zero to as much as 1 second, but nothing works.
Worth noting that when I looked at the DECODE TYPE when receiving, it came back as UNKNOWN. But from what I can tell, that hex code is certainly for type NEC.
Have you tried sending groups of number other than 3, ... just once... 5 times, 8 times etc.?
Another possibility is that you have captured an "off" code instead of an "on/off" code. Then it will turn the TV off, but of course not on when it is off because you're asking it to turn "off" after all...
What appears on the serial monitor with a few cycles of on/off? The same data?
What I'm saying, maybe your Harmony is commanding it differently than the original controller.
The irsend commands have alternative versions that allow you to specify the repeat count.
Try... irsend.sendNEC(0xE0E040BF, 32, 3);
to send the same command 3 times instead of the way your doing it now.
aarg:
Have you tried sending groups of number other than 3, ... just once... 5 times, 8 times etc.?
Another possibility is that you have captured an "off" code instead of an "on/off" code. Then it will turn the TV off, but of course not on when it is off because you're asking it to turn "off" after all...
What appears on the serial monitor with a few cycles of on/off? The same data?
What I'm saying, maybe your Harmony is commanding it differently than the original controller.
I double-checked the TV manual for the remote commands and this TV only has a toggle on/off power button so it's the same button being used. The Harmony also consistently gives me that code 3 times. Now what I did try is another universal remote I had laying around. An old RCA all-in-one. So I programmed that for the TV and that too also successfully turns on/off the TV with one power button. I captured the codes for that one, and they were slightly different. It gave me:
NEC: E0E040BF (same as the Harmony)
UNKNOWN: 4AB0F7B6
UNKNOWN: 4AB0F7B6
Trying these gave me the same thing though. When sent from the Mega's transmitter, it turns the TV off fine but won't turn it back on.
Riva:
The irsend commands have alternative versions that allow you to specify the repeat count.
Try... irsend.sendNEC(0xE0E040BF, 32, 3);
to send the same command 3 times instead of the way your doing it now.
aarg:
Did you try using 3 arguments? You got an error?
Yeah got an error.
However... I got it working! I found another library online that is way better, called IRLibAll. With this library you can define more protocols such as:
IR is one of those things that has a proliferation of similar or same named libraries. That's why the mix up above can happen. Sometimes it is just a matter of finding the right one.