Image capture using Arducam OV5642

I am using Arducam OV5642 (with UNO) and want to capture still images using a digital high signal. The arduino will remain connected to a PC and I want to capture an image when one of the pin on arduino (say pin 3) goes high. I have the example code which can be used to capture images using Host_v2 app but I want to capture the image using a digital signal on the UNO board. Can someone help me with the code?

Thank you


So I modified example code to capture images using pin 3 HIGH mode instead of reading the input from the capture button on Host_V2 app.

//if (Serial.available()) // this was in the example code
if (digitalRead(3) == HIGH) //changed to pin 3 condition
//temp =; // this was in the example code
temp = 0x10; // this condition will be selected instead of reading the input
switch (temp)
case 0x10:
mode = 1;
temp = 0xff;
start_capture = 1;
Serial.println(F("ACK CMD CAM start single shoot. END"));

if (mode == 1)
if (start_capture == 1)
//Start capture
start_capture = 0;
Serial.println(F("ACK CMD CAM Capture Done. END"));delay(50);
//Clear the capture done flag

I tried printing the input and it gets till start_capture() but the rest of it is not executed. I mean the capturing part is not executed. What does get_bit do? Does it read bits? What should I replace (myCAM.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK)) with or should I remove the last if condition?