Dag Rob,
I changed the code but the stepper isn't moving.. Am i missing something?
#define SHUTTER_PIN 7
#define STEPPER_PIN 8
int maxshots = 4;
int shots = 0;
int Distance = 0; // Record the number of steps we've taken
void setup() {
pinMode(9, OUTPUT);
digitalWrite(9, LOW);
}
void loop()
{
if (shots < maxshots)
{
rotate();
shots = shots + 1; // or shots++; in short
}
// do other things here
}
void rotate()
{
digitalWrite(STEPPER_PIN, HIGH);
delayMicroseconds(60);
digitalWrite(STEPPER_PIN, LOW);
delayMicroseconds(60);
Distance = Distance + 1; // record this step
// Check to see if we are at the end of our move
if (Distance == 21481) // 4 fotos per omwenteling
{
Distance = 0;
// Now pause for a second
delay(1000);
digitalWrite(SHUTTER_PIN, LOW);
delay(2000); // lengte schots
digitalWrite(SHUTTER_PIN, HIGH);
}
}