// stepper motor driver demonstrating quadrature signal
// https://wokwi.com/projects/366564969435619329
// Used to create the image on
// for https://forum.arduino.cc/t/accelstepper-run-question/1121994/16
// https://wokwi.com/projects/363629517927347201
// Copied fron https://wokwi.com/projects/360399388158511105
// Bounce.pde
// -*- mode: C++ -*-
//
// Make a single stepper bounce from one limit to another
//
// Copyright (C) 2012 Mike McCauley
// $Id: Random.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $
#include "AccelStepper.h"
// Define a stepper and the pins it will use
AccelStepper stepper; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
void setup()
{
// Change these to suit your stepper if you want
stepper.setMaxSpeed(300);
stepper.setAcceleration(25);
stepper.moveTo(8);
}
void loop()
{
// If at the end of travel go to the other end
if (stepper.distanceToGo() == 0)
stepper.moveTo(-stepper.currentPosition());
stepper.run();
}