ir code keeps repeating it self problem

hey every one
i need some help on my project
i`m trying to make ir sender for my tv and satallite reciver to use it on my mobile using remotexy app
the communication between mobile and the board is estiablished and works fine till i start press any button on the app .
it starts to go in a loop of repeating the ir code for ever , and this of course will stop the connection too
the question is
how to prevent the repeating code from being repeated for ever
ie. is there a certain command can i add to stop ir from sending

ir_remote_control_mega.ino (17.7 KB)

The error is most probably in the code you're hiding from us (RemoteXY).

My (wild) guess is that you forgot to reset the state. So if RemoteXY.button_1 is set to 1 at any time, it will never be reset so the corresponding code is sent over and over again.