Hello, NP.
Thank you for your response.
I partially implemented your idear, namely:
1. The controller (Arduino) lights the LED
2. The camera makes the shots until it finds the object (spot from LED)
3. The camera sends the reply to the controller that the short is done.
4. The controller waits 1 second and lights the LED...(the loop repeats)
So in this way the LED makes impulses.
The code looks as follows:
Code: Select all
int objCount = 0;
while (objCount == 0) // repeat until an object is found
{
frame = NULL;
while(!frame) { frame = camera_01->GetLatestFrame(); }
objCount = frame->ObjectCount();
}
if(frame)
{
frame->Rasterize(framebuffer);
frame->Release();
obj1 = frame->Object(0);
}
WriteFile(hSerial, chBuff, 1, &dwBytesRead, NULL); // send signal to controller to turn off the LED
So the problem is that after just one successful cycle the algorithm stays in the
while(!frame) { frame = camera_01->GetLatestFrame(); }
loop. The frame remains always NULL. This, however does not happen in following cases:
1. When the breakpoints are set and the code is run slowly with debugger.
2. LED are always on, that is there is no permanent turning on/off of the LED.
Could you please help me understand this? Thank you.