my intention is when I press button 1 on the remote control, (on / off the relay), same thing for button 2, now when button 3 is pressed, it sends the infrared, for example to increase the TV volume
When I press 1 and 2, everything works normally (on / off the relay), but when I press button 3, it only sends the infrared code once, and when I press button 3 again nothing happens, and even when I press the button again button 1 and 2, they do not work (relay on / off)
#include <IRremote.h>
int RECV_PIN = 11;
const int Rele1 = 10;
const int Rele2 = 7;
int flag0, flag1, flag3;
my intention is when I press button 1 on the remote control, (on / off the relay), same thing for button 2, now when button 3 is pressed, it sends the infrared, for example to increase the TV volume
When I press 1 and 2, everything works normally (on / off the relay), but when I press button 3, it only sends the infrared code once, and when I press button 3 again nothing happens, and even when I press the button again button 1 and 2, they do not work (relay on / off)
Ken Shirriff said in an old post (#5), and it probably still holds true:
You can't use sending and receiving at the same time. When you do a send, the receiving is disabled. To re-enable it after sending you need to call:
irrecv.enableIRIn(); // Start the receiver