//#include "Arduino.h"
#include "SpeedyStepper.h"
const int LED_PIN = 13;
const int MOTOR_STEP_PIN = 3;
const int MOTOR_DIRECTION_PIN = 4;
//
// create the stepper motor object
//
SpeedyStepper stepper;
void setup()
{
//
// setup the LED pin and enable print statements
//
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600);
//
// connect and configure the stepper motor to its IO pins
//
stepper.connectToPins(MOTOR_STEP_PIN, MOTOR_DIRECTION_PIN);
}
void loop()
{
//
// Note 1: It is assumed that you are using a stepper motor with a
// 1.8 degree step angle (which is 200 steps/revolution). This is the
// most common type of stepper.
//
// Note 2: It is also assumed that your stepper driver board is
// configured for 1x microstepping.
//
// It is OK if these assumptions are not correct, your motor will just
// turn less than a full rotation when commanded to.
//
// Note 3: This example uses "relative" motions. This means that each
// command will move the number of steps given, starting from it's
// current position.
//
//
// set the speed and acceleration rates for the stepper motor
//
stepper.setSpeedInStepsPerSecond(100);
stepper.setAccelerationInStepsPerSecondPerSecond(100);
//
// Rotate the motor in the forward direction one revolution (200 steps).
// This function call will not return until the motion is complete.
//
stepper.moveRelativeInSteps(200);
//
// now that the rotation has finished, delay 1 second before starting
// the next move
//
delay(1000);
//
// rotate backward 1 rotation, then wait 1 second
//
stepper.moveRelativeInSteps(-200);
delay(1000);
//
// This time speedup the motor, turning 10 revolutions. Note if you
// tell a stepper motor to go faster than it can, it just stops.
//
stepper.setSpeedInStepsPerSecond(800);
stepper.setAccelerationInStepsPerSecondPerSecond(800);
stepper.moveRelativeInSteps(200 * 10);
delay(2000);
}