Image capture using Arducam OV5642

Hello,
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

(deleted)

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 = Serial.read(); // 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"));
break;
....
}

if (mode == 1)
{
if (start_capture == 1)
{
myCAM.flush_fifo();
myCAM.clear_fifo_flag();
//Start capture
myCAM.start_capture();
start_capture = 0;
}
if (myCAM.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK))
{
Serial.println(F("ACK CMD CAM Capture Done. END"));delay(50);
read_fifo_burst(myCAM);
//Clear the capture done flag
myCAM.clear_fifo_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?