User:Gharris/sketchone

''#include 

AF_Stepper motor(200, 2);

int led = 10; //set digital pin to 10

void setup {

pinMode (led, OUTPUT); //for solenoid Serial.begin(9600);          // set up Serial library at 9600 bps Serial.println("Stepper test!");

motor.setSpeed(10); // 10 rpm

motor.step(100, FORWARD, SINGLE); motor.release; delay(1000);

}

void loop {

for (int i = 0; i < 40; i++) {

for (int j = 0; j < 40; j++) {  for (int k = 0; k < 40; k++) {    //loop through all 64,00 combinations motor.step((i * 2.5), FORWARD, DOUBLE); delay(500); motor.step((j * 2.5), BACKWARD, DOUBLE); delay(500); motor.step((k * 2.5), FORWARD, DOUBLE); delay(2000); //pull selenoid digitalWrite (led, HIGH); delay (1000); digitalWrite (led, LOW); delay (1000); //check position sensor if / else statement //position at zero for next combination motor.step((k * 2.5), BACKWARD, DOUBLE); delay(2000); //spin 2 full rotations to clear previous combination motor.step((80 * 2.5), FORWARD, DOUBLE); delay(2000); } }

} } ''