Go Down

Topic: (Solved) ir remote relay control (Read 2122 times) previous topic - next topic

Wiki

I have assign button # 1 (Sony remote) to turn on/off the LED on pin 13
it works fine but some times the remote button is pressed for longer period and sometimes for short period
the IR receiver continuously receive signal from the remote, now when i press the remote button for a longer period it receives 3 to 5 signals and 2 to 3 signals when button is pressed for short period
like it receives
"
16 ----> ON
16 ----> OFF
16 ----> ON
16 ----> OFF
"
result is OFF

when the signal is received 3 times like
"
16 ----> ON
16 ----> OFF
16 ----> ON
"
result is ON

I want the receiver to receive signal only once if I press the remote button for a longer or shorter period

guix

Hello and welcome Wiki,

First, just so you know, this:
Code: [Select]

digitalWrite (LED1, on ? HIGH : LOW);

Could be changed to this:
Code: [Select]

digitalWrite (LED1, on);

It's the same thing (but then I suggest renaming "int on" to "bool LED1_state" or something like that :)

Then, to solve your problem, study this code: https://github.com/shirriff/Arduino-IRremote/blob/master/examples/IRrelay/IRrelay.ino

And next time, start your own topic :)

Go Up