Synchronizing 4 Point Grey Chameleons Using Arduino Uno

I am working on building a 4 camera array with Point Grey Chameleons and Raspberry Pis. The cameras need to be exactly synchronized for every frame, so I am using an Arduino Uno to trigger a pulse of high,low to the cameras to trigger a frame every 0.1 seconds. The program (Flycapture) that the cameras run on receives the pulse and triggers the camera to take a frame. I don't know what code to use to program the Arduino Uno to do this. Any ideas?

int pin = 3; // Sets digital output pin to 3 void setup() { pinMode(pin, OUTPUT); } void loop() { digitalWrite (pin, LOW); delay(.1); // pulse length you want digitalWrite (pin, HIGH); }

If you connect the GPIO trigger pin to digital output pin 3, this code should work. It pulses high ever .1 seconds.

wpf1321: delay(.1); // pulse length you want

Would that work? (It may, but I have never tried it.) If that doesn't, use delayMicroseconds(100) instead.

Oh whoops, the delay (.1) is in milliseconds so change the .1 to 100

Since the frame rate matters, don't use a fixed delay - instead use millis() to determine when it is time for the next frame.

// incomplete, untested
void loop()
{
    static unsigned long lastFrameTime = millis();
    const unsigned long FrameInterval = 100;

    if(millis() - lastFrameTime > FrameInterval)
    {
        // time for the next frame
        frame();
        lastFrameTime += FrameInterval;
    }
}

void frame()
{
    digitalWrite (pin, HIGH); 
    delay(10);                      // whatever pulse length you want
    digitalWrite (pin, LOW);
}