Skip to content

Instantly share code, notes, and snippets.

@jmtexla68
Created June 3, 2016 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmtexla68/a4e6748e9012f133dea39e2f5ea0cb04 to your computer and use it in GitHub Desktop.
Save jmtexla68/a4e6748e9012f133dea39e2f5ea0cb04 to your computer and use it in GitHub Desktop.
Otro ejemplo de utilización con Arduino y el Arduino Motor Shield R3. https://conbotassucias.wordpress.com/
#include <Stepper.h>
const int pwmA = 3;
const int pwmB = 11;
const int dirA = 12;
const int dirB = 13;
// Cantidad de pasos para una revolución completa.
// 360 / Angulo de cada paso (1.8)
const int STEPS = 200;
Stepper myStepper(STEPS, dirA, dirB);
void setup() {
// Velocidad, Revoluciones por minuto del motor
myStepper.setSpeed(300);
pinMode(pwmA, OUTPUT);
digitalWrite(pwmA, HIGH);
pinMode(pwmB, OUTPUT);
digitalWrite(pwmB, HIGH);
}
void loop() {
// Cantidad de pasos que se movera el motor.
myStepper.step(20000000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment