     } ;//end of for
 };// end of Step
  
-void DCU (int output)
+void DCU (int output)// This segment of code is copied from a DCU sketch as a complete module
 {
   switch (output) 
   {

{
DCU(0);//Turn off all lines
delay (1000);
Step(100,0);//rotate clockwise
delay (1000);
Step(100,1);// rotate counter clockwise
} ;// end of loop
 
void Step(int Steps, int direction)
{
  int x;
  int StepValue;if (direction ==0)
    {
      DCUStep[0]=5;//,9,10,6}; //on this order for CW
      DCUStep[1]=9;
      DCUStep[2]=10;
      DCUStep[3]=6; 
    }
    else
     {
       DCUStep[0]=6;//,9,10,6}; //on this order for CW
       DCUStep[1]=10;
       DCUStep[2]=9;
       DCUStep[3]=5; 
    }
  for (x=0; x<=Steps; x++) // set up step pattern
    {
      output = x%4;
      StepValue = DCUStep[output];
      DCU(StepValue);
      Serial.print(output);
      Serial.print("  ");
      Serial.println(StepValue);

Controls a stepper motor (unipolar or bipolar) connected to a Vernier Digital
Control Unit (DCU) connected to BTD 2 connector.

Stepper motors are unique in that they allow for very exact positioning of the 
drive shaft. Additional guidance related to stepper motors can be found in the 
user manual for the DCU http://www.vernier.com/files/manuals/dcu-btd.pdf 

This sketch causes the stepper motor to rotate 100 steps and then the rotation
pauses for one second and the rotation is repeated in the opposite direction.
See www.vernier.com/arduino for more information.

The sketch makes use of a segment of code for the DCU. 

There are at least two points of note for this sketch. First the DCU must have 
an external power source in order drive the motor. Second, if you try to cycle the 
stepper motor too quickly (by having a small int Duration) the motor may not be 
able to complete its cycle before being forced to start again. In both cases you will 
observe the shaft on the motor vibrating, but not rotating.

*/

int Duration=50; /*step time in ms. If this value is too low for your motor 
it will cause the motor to shake without moving.*/
int Direction =0;//direction 0 =CW, 1 = CCW
//the lines below are so that you can quickly change this code if you want to
//use the DCU in the BTD1 connector for some reason.
