Please help me in programing problem!!!

So I trying to control relay remotely (433mhz) with a button that when I pressed the button the relay open (send the code word) and when I stop the push of a button (send again codeword just once) then close relay.

Well, the program always sanding the code.

here is:

void loop()
{

   buttonState = digitalRead(buttonPin);

 // if the pushbutton is pressed.
                                                                                
       digitalWrite(ledPin2, HIGH);   // turn LED on: 

    Temporary[2] = 0x0C;// 0x0C is C button key
  digitalWrite(ledPin, HIGH);//Turn on led
    send_data();//send code word
   Serial.println(".....trigger C channel relay remote ON"); 
                                                       } 
       else 
                  {
                 digitalWrite(ledPin2, LOW);

                Temporary[2] = 0x0C;// 0x0C is C button key
                 digitalWrite(ledPin, HIGH);//Turn on led
                send_data();//send code word
                Serial.println(".....trigger C channel relay remote OFF");

            }

I know sending a data because this in a loop but I wnat to running just once

I know sending a data because this in a loop but I wnat to running just once

You are sending data when the switch IS pressed, not when it BECOMES pressed, and when it IS released, rather than when it BECOMES released.

Look at the state change detection example.

marci1666:
So I trying to control relay remotely (433mhz) with a button that when I pressed the button the relay open (send the code word) and when I stop the push of a button (send again codeword just once) then close relay.

Well, the program always sanding the code.

void loop(){

buttonState = digitalRead(buttonPin);
// if the pushbutton is pressed

Where's the code that determines that? You have an else without an if.