Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <AccelStepper.h>
AccelStepper stepper(1, 9, 8);//(define el tipo de control del motor,pin de paso,pin direccion)
int pos = 100;
void setup()
{
stepper.setMaxSpeed(800); //velocidad maxima permitida
stepper.setAcceleration(500);// relacion entre aceleracion/desaceleracion
}
void loop()
{
if (stepper.distanceToGo() == 0)//distancia de la posicion actual y la destino
{
delay(500);
pos = -pos;
stepper.moveTo(pos);//establece la posicion de destino
}
stepper.run();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.