User:Jdittman8063/ENES-100/project 2/Test

//uses Adafruit Motor shield library
 * 1) include 

AF_Stepper motor(200, 2); int led = 6; //set solenoid to digital pin 6

void setup { Serial.begin(9600);   // set up Serial library at 9600 bps Serial.println("Short test of stepper motor."); motor.setSpeed(10); // 10 rpm }

void loop { //loop through combinations from 1,1,1 to 2,2,2 //total of eight iterations through the loop for (int a=1; a<=2; a++){ for (int b=1; b<=2; b++){ for (int c=1; c<=2; c++){

motor.step(a, FORWARD, DOUBLE); delay(100);

motor.step(200, BACKWARD, DOUBLE); //one full rotation backwards to pass zero delay(100);

motor.step(b, BACKWARD, DOUBLE); delay(100);

motor.step(c, FORWARD, DOUBLE); delay(100);

//print the combination used in this iteration Serial.print(“1st Number is “); Serial.println(a, BIN); Serial.print(“2nd Number is “); Serial.println(b, BIN); Serial.print(“3rd Number is “); Serial.println(c, BIN);

motor.step((a+c-b), BACKWARD, DOUBLE); //reset to position zero motor.step(400,FORWARD, DOUBLE); //two full rotations to reset locking mechanism delay(500); }       }    } }