more!

1. Arduino Code

Here’s the code to load onto the Arduino:

#include <NikonRemote.h>
NikonRemote remote(12);
void setup(void) {
}
void loop(void){
remote.Snap();
delay(300000); // 5 second delay
}

The library I’m referencing was made by pasting Cibo’s code into the Arduino environment, saving it as a sketch, then renaming the seperate files to the titles he referenced [NikonRemote.h and NikonRemote.cpp]. I avoided using an intermediary text editor because it created syntatical problems.

Here is the NikonRemote library file that I created with Cibo’s code, and here is my Arduino sketch file.

 

 

2. Image Compiler Program

Then, I created a piece of code that displays sequential images at a set frame pacing, then export a .MOV file.

I want to note that key parts of my code are from the “MovieMaker” example sketch that is included with Processing. Here is a test video, here is the sketch folder, and below is the code. [thanks to Steve G. for help with the image array]

//TIMELAPSE_compiler v4
//code written with help from MovieMaker sample sketch
//loads images, then displays timelapse video
//timelapse is saved as a "timelapse.mov", in the sketch's folder

import processing.video.*;
MovieMaker counter;
int numFrames = 208; // The number of frames to be displayed
int frame = 1;
PImage[] images = new PImage[numFrames];

void setup() {
frameRate(3);
noStroke();
for(int i=1; i<numFrames; i++) {
images[i] = loadImage(i + ".jpg");
}
size(images[1].width, images[1].height);
counter = new MovieMaker(this, width, height,"timelapse.mov");
}

void draw() {
frame = (frame+1)%numFrames; // Use % to cycle through frames
image(images[frame], 0, 0);
counter.addFrame();
}

void keyPressed() {
if (key == ' ') {//if spacebar is pressed, quit the program
counter.finish();
exit();
rect(0, 0, 200, 133);
}
}

3. Extensions

-adding switches/code so intervals can be changed without having to upload new code to the Arduino.

-variable intervals based on how fast something, or the camera, is moving

-automatic directory setup for compiling images

-power down feature to save on battery life

 

[a project developed at www.danreetz.com/research]