a timing problem.

Here's my dilemma,

I have an stepper/arduino powered camera dolly, that i need to move straight after my cameras shutter opens, so the photo is blurry. At the moment, I have a push button. when i press my pushbutton, the camera moves, stops, THEN it takes a photo. according to my script i thought the camera would go off first, and the motor would move as the shutter was open.

originally i had the software 'dragon' taking a photo then sending a que to the arduino which would move the motor. This worked but the director of photography pleaded with me that the camera be moving WHILE it takes a shot.

so then i added a push button to the arduino and made IT send a command to the dragon software and the stepper driver, i was hoping by putting the arduino at the top of the chain, it would result in the two actions happening at the same time but it didn't really seem to change anything it just moves the stepper and then takes a photo.

here is my code:

#include <Stepper.h>
#define STEPS 200
#include <DragonStopMotion.h>
#include <stdlib.h>

#define DRAGON_SHOOT_CMD  1

Stepper stepper(STEPS, 12, 13, 0, 0);

DragonStopMotion dsm = DragonStopMotion();

const int buttonPin = 2;     // the number of the pushbutton pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {

 Serial.begin(57600);

   // When input pin 5 goes LOW, send DSM a SHOOT 1 frame command
dsm.activatePin(2, LOW, DRAGON_SHOOT_CMD, 1);

// When input pin 4 goes LOW, send DSM a DELETE command
dsm.activatePin(4, LOW, DRAGON_DELETE_CMD);

// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);

stepper.setSpeed(8);
}

void loop(){

// tell dsm to check for inputs and send messages to DSM if needed
dsm.processPins();

// read serial messages from DSM
int cmd = dsm.processSerial();

// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == LOW) {
stepper.step(50);
}
}

i'm not sure if it's possible or if i will maybe need another arduino or what. I'm hoping that it's actually simpler than i realised and i don't need a pushbutton and i can get them both to move at the same time just from Dragon.

I tried putting a delay before stepper.step but then it still waited until the camera move was over until taking the photo.

any help/advice is welcome.

thanks in advance,
mark.

DragonStopMotion dsm = DragonStopMotion();

I've never heard of this library. Tell us more about it.

Ok.. realised i uploaded the wrong script, couldn't remember what the right one was so i re did it and now it pretty much works as i wanted it to? Just had to add a delay on the motor moving..

my only problem now is that dragon doesn't capture every time i press the button, i'm hoping that's because it's old and worn. My next best bet is a wii-mote which i have right here,

new question though, communication between arduino and dragon and arduino and the wii-mote appear to require different serial baud rate's to be set, can i set more than one serial baud rate in the void setup in a sketch? Or would i change something in either of their libraries to make them both the same baud rate.

PaulS you can check out the dragon/aduino stuff here:
http://www.dragonstopmotion.com/arduino/index.php

on the right side there are resources and a couple of examples at the bottom that illustrate communication from dragon to arduino and vice versa.

communication between arduino and dragon and arduino and the wii-mote appear to require different serial baud rate's to be set, can i set more than one serial baud rate in the void setup in a sketch?

No.

Or would i change something in either of their libraries to make them both the same baud rate.

Possibly. However, you can have only one thing connected to the hardware serial port at one time, so it seems an academic exercise.

You could connect one of the devices to a different set of pins, and use NewSoftSerial to communicate with it.

thanks for the tip i'll give it a go