BLYNK WRITE repeat twice

hi can someone help with my code
i using this code to turn on my aircon
with virtual pin 14 i have to press the button twice for it to work
how can i make the command send it twice with one push of the button


BLYNK_WRITE(V14){     //  AIRCON ON HEAT 30c
  
int onoff = param.asInt();
  if(onoff == 1){
    
    #if SEND_PANASONIC_AC
  Serial.println("Sending IR command to A/C ...");
  ac.send();
  ac.setModel(kPanasonicRkr);
  ac.on();
  ac.setFan(kPanasonicAcFanMin + 2);
  ac.setMode(kPanasonicAcHeat);
  ac.setTemp(30);
  ac.setSwingVertical(kPanasonicAcSwingVMiddle);
  ac.setSwingHorizontal(kPanasonicAcSwingHMiddle);
  
#endif  // SEND_PANASONIC_AC
  printState();

@nickxippas please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

#if SEND_PANASONIC_AC
Serial.println(“Sending IR command to A/C …”);

for (int i=0; i <= 1; i++){ //twice
   ac.send();
   }
2 Likes