Pages: 1 [2]   Go Down
Author Topic: (Solved) ir remote relay control  (Read 1820 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

France
Offline Offline
Edison Member
*
Karma: 38
Posts: 1012
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello and welcome Wiki,

First, just so you know, this:
Code:
digitalWrite (LED1, on ? HIGH : LOW);
Could be changed to this:
Code:
digitalWrite (LED1, on);
It's the same thing (but then I suggest renaming "int on" to "bool LED1_state" or something like that smiley

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 smiley
Logged

Pages: 1 [2]   Go Up
Jump to: