#define PIN_RICHTING 2
#define PIN_STEP 3
#define cw 1
#define ccw 0
#define totaalSteps 400
void stuurMotorAan();
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(PIN_RICHTING, OUTPUT);
  pinMode(PIN_STEP, OUTPUT);
  stuurMotorAan(totaalSteps, cw); // eerste viod functie:  400 steps, richting cw 
  delay(1000); // mogelijke stilstand tussen de 2 richtingen.
  stuurMotorAan(totaalSteps, ccw);// tweede void functie:  400 steps, richting ccw
                   // Tweede maal cyclus.
  /*delay(1000); // mogelijke stilstand tussen de 2 richtingen.
  stuurMotorAan(totaalSteps, cw); // eerste viod functie:  400 steps, richting cw 
  delay(1000); // mogelijke stilstand tussen de 2 richtingen.
  stuurMotorAan(totaalSteps, ccw);// tweede void functie:  400 steps, richting ccw*/
}
void loop() {
  // put your main code here, to run repeatedly:
} 
// totaalSteps komt in pulsen, cw of ccw komt in richting.
void stuurMotorAan(int pulsen, bool richting) {
  digitalWrite(PIN_RICHTING, richting);
  for (int i = 0; i < pulsen; i++) {
    digitalWrite(PIN_STEP, HIGH);
    delay(10);
    digitalWrite(PIN_STEP, LOW);
    delay(10);
  }
}