Created
June 3, 2016 19:31
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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