F+P Ideenfabrik



/*
 Stepper Motor Control - one revolution

 This program drives a unipolar or bipolar stepper motor.
 The motor is attached to digital pins 8 - 11 of the Arduino.

 The motor should revolve one revolution in one direction, then
 one revolution in the other direction.


 Created 11 Mar. 2007
 Modified 12.05.2015
 by Trixi-N

 */

#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 25,23,24,22); 

void setup() {
  // set the speed at 60 rpm:
  myStepper.setSpeed(100);
  // initialize the serial port:
  Serial.begin(115200);
}

void loop() {
  // step one revolution  in one direction:
  Serial.println("Vorwaerts");
  myStepper.step(stepsPerRevolution);
  delay(2500);

  // step one revolution in the other direction:
  Serial.println("Rückwaerts");
  myStepper.step(-stepsPerRevolution);
  delay(2500);
}


http://www.gratis-besucherzaehler.de