efficient time delay loop

I know..... E=IR but the = sign is not useable

I am making an intervalometer for my ancient kodak carousal projector.
a servo hooked to the forward button of the hand remote will fire at
pre-determined intervals.
I'm using the UNO .

how can I make this sketch more efficient thru software only?
this is my simplistic sketch

rduino Servo Test sketch
*/
#include <Servo.h>
Servo servoMain; // Define our Servo

void setup()
{
servoMain.attach(10); // servo on digital pin 10
}

void loop()
{
servoMain.write(100); // Turn Servo Left to 100 degrees
delay(250); // Wait 0.25 second
servoMain.write(80); // Turn Servo Left to 80 degrees
delay(3000);
}

THANKS

e-ir:
I know..... E=IR but the = sign is not useable

I am making an intervalometer for my ancient kodak carousal projector.
a servo hooked to the forward button of the hand remote will fire at
pre-determined intervals.
I'm using the UNO .

how can I make this sketch more efficient thru software only?
this is my simplistic sketch

rduino Servo Test sketch
*/
#include <Servo.h>
Servo servoMain; // Define our Servo

void setup()
{
servoMain.attach(10); // servo on digital pin 10
}

void loop()
{
servoMain.write(100); // Turn Servo Left to 100 degrees
delay(250); // Wait 0.25 second
servoMain.write(80); // Turn Servo Left to 80 degrees
delay(3000);
}

THANKS

Define what you mean by efficient, the sketch does what it needs to do?
you're not running out of memory?

You could reduce the file size needed to hold the sketch source by removing all the comments and redundant whitespace, using shorter variable names and eliminating line feeds. This would also make the compiler run microscopically faster. (It would also render the sketch much harder to read and understand.)

You could reduce the time taken to move the servos by making the delays shorter.

You could reduce the energy consumption by making the board sleep between servo movements.

You could minimise the development effort by leaving the code alone as soon as it does what you want.

Any of these changes could be considered an efficiency improvement. I have no idea whether any of them relate to what you mean by efficiency.

you're right..point taken

I've got a nikon d3oo pointed into the kodak projecter, using the camera's intervalometer set to fire the shutter every 2 seconds.
as you see, the projector is set to move to a new slide every 3 ( I've also tried 4) seconds.
I'm trying to make an automatic slide duplicator.

although both triggers start at the same time , i find that around the 12th slide, the timing starts to deviate i.e. some slides are missed at about each successive 12th slide.

i was wondering if a software (sketch) fix was a possibility or do I have to go to a timer chip.

Thanks....

as you see, the projector is set to move to a new slide every 3 ( I've also tried 4) seconds.

I'm not sure I do see that - it looks more like 3.25 seconds to me.

Is there anyway to get feedback from one device to the other to keep them in sync?

Or, tweak the 3 seconds some - back it down to 2750, increase to 3250, small changes like that.

yep... i forgot the delay

but i still find the accuracy with my sketch lacking.
any way to improve upon that by using different functions?
I'm making the assumption that the Nikon's intervalometer is more accurate.

Thanks

I'm making the assumption that the Nikon's intervalometer is more accurate.

Have you timed it to see? Could be an 8-bit micro running on a resonator too.

Hi e-ir

Does the Nikon have the kind of remote shutter release which is a push button switch on a cable - I mean an electrical switch (not the old style mechanical ones which were like bicycle brake cable)?

If so, it ought to be possible to make the Arduino trigger the shutter and thereby ensure that things stay in sync with the projector slide change.

If you Google "arduino camera shutter release" and ignore the items about high-speed image capture, it looks like there is material which could be useful.

All the best

Ray

Hi Ray,

the Nikon has a menu driven intervalometer as well as a push button switch (manual).
good idea..im going to give it a try.

Thanks to all for your insightful ideas !!

I'll be checking back here if there are any other suggestions .

One other option. The flash mounting on top of the camera (hot shoe, I think) has contacts which are switched by the camera to trigger the flash. Just found this link to a discussion about whether that could be used to trigger an Arduino.

as a semi-pro photographer, I should have known this!

always learning....

Thanks Hackscribble