IRreciver and IRsender for TV and STB

Hello everyone,
I’m making very simple project with IRremote library. The purpose of this is to automatically turn on TV by simply pressing satellite receiver power button on remote.
At the beginng I read all infrared codes in HEX from both remote controls. Then I tried to send IR codes by infrared diode and it’s also works quite well.

The problem began when I tried to recive a code and than send new one. It’s just works once and than stopped. In the example bellow it recived a code EE117887 from STB remote control and send a code 409FF20D to TV three times.
TV automatically turn on but after that arduino can’t receive any other IR code and I have to reset it if I want to use it again.

I’m quite newbie in programing and I know that there might be some mistakes in code.
Anyone have similar issues with IRsend? Or maybe someone can check a code and help me to find a mistake? The code is very simple but I still don’t know what can I do to fix the problem.

Thanks in advance

#include <IRremote.h>

const int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results results;
unsigned long key_value = 0;

void setup(){

void loop(){
  if (irrecv.decode(&results)){
        if (results.value == 0xEE117887){
          for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0x409FF20D, 32);

Just after irrecv.resume(); I had add this:

        setup () ;
        return ;

And it works fine, but if anyone have some sugestion please wrote the below

It looks like you should add irrecv.enableIRIn() after sending.