This example syncronize your camera with an external input signal.
Sometimes in a vision application, you will want to synchronise camera snaps off an external synchronisation signal. In the most simplest of cases, the sync. signal is a sinusoidal wave, and you'd want the camera to snap an image every time a there is a peak on the synchronisation signal.
A good way to achieve this is to use a producer-consumer architecture. In this way, a camera snap can be placed in a loop that will only execute when triggered to by an another loop.
So, in this example, a top loop runs continuously looking for the peak in the synchronisation signal. When it detects a peak, it sends a value into a notifier (basically just a single element queue), allowing the bottom loop to run.
In this example, a simulated signal is used. You can easily replace this with a real signal using DAQmx to actually acquire that real signal. Note, you will need to know before-hand the amplitude of your input signal.