Dragon Stop Motion logo
The premier capture software for stop-motion animation, motion design and visual effects.
Loading...
Home > Arduino Integration
Arduino Example #2 - Triggering a Stereo Slider

Example #2: Moves a stereo slider when Dragon Stop Motion switches between left-eye and right-eye positions. This would work with the Mark Roberts S3 Stereoscopic Stepper, for example.

#include <DragonStopMotion.h>

/*
 * Dragon Stop Motion stereo slider example for Arduino.
 */

// output pin wired to stereo slider
#define STEREO_TRIGGER_PIN 7

// track the stereo position
char stereoPosition = 'L';

// Create global object to communicate with Dragon Stop Motion
DragonStopMotion dsm = DragonStopMotion();

/*
 * Arduino calls this function once, at the start of your program.
 */
void setup()
{
  // set up serial port to 57600 kbps
  Serial.begin(57600);
  
  /*
   * Configure output pin for triggering stereo slider.
   */
  pinMode(STEREO_TRIGGER_PIN, OUTPUT);
  digitalWrite(STEREO_TRIGGER_PIN, LOW);
}

/**
 * Arduino calls this function repeatedly as the main program loop.
 */
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();

/** * Send pulse to stereo slider based on exposure name. * This example sets a digital I/O pin high for 0.5 seconds. */ if (cmd == DRAGON_POSITION_MSG) { if (dsm.commandExposureName[0] != stereoPosition) { digitalWrite(STEREO_TRIGGER_PIN, HIGH); delay(500); digitalWrite(STEREO_TRIGGER_PIN, LOW); stereoPosition = dsm.commandExposureName[0]; } }
}