Problem sending IR pronto code

Hi,
I have a strange problem on a simple code. I try to send an ir hex code(in pronto format) to trigger shutter on a sony camera. I found a library here which seems to do the job, the code below work good for the first send however when I try again nothing happen. Using my cellphone camera to see if the ir on my board effectively working I notice that the first burst is sent correctly and triggers my camera however next bursts are shorter like if no data were transmitted...

Is anything wrong with my code? Did anyone have successfully use this library before?

#include <Pronto.h>

Pronto pronto(9);

uint16_t shutter[46] = {0x0000, 0x0068, 0x0000, 0x0015, 0x0060, 0x0018, 0x0030, 0x0018, 0x0018, 0x0018, 0x0030, 0x0018, 0x0030, 0x0018, 0x0018, 0x0018, 0x0030, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0030, 0x0018, 0x0018, 0x0018, 0x0030, 0x0018, 0x0030, 0x0018, 0x0030, 0x0018, 0x00018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0030, 0x0018, 0x0030, 0x0018, 0x0030, 0x0018, 0x0030, 0x01C8};

int switchState;
    
void setup() {
  pinMode(2, INPUT);
  
}

void loop() {

   switchState = digitalRead(2);
     if (switchState == HIGH) {
      
      pronto.ir_start(shutter);
            }

    }

Thanks for your help! :slight_smile:

How is the switch wired? Since the loop() function is executed over and over very quickly, the pronto.ir_start(shutter) function is sent many many times as long as the button is held. I don't know if that will have an adverse effect, but it could. Look at the state change detection example to see how to execute the pronto.ir_start(shutter) function only when the switch becomes pressed so that it only happens once per press (not 100's).

Thanks for your reply however the switch is not the problem, i've add a delay(500); and serial print to see when the switch is pressed (one time with the delay) and it dont solve the problem.