How to connect stepper motor in Wemos mini
Posted: Wed Feb 14, 2018 6:37 pm
How do I connect a stepper motor in Wemos Mini, I'm following a tutorial for arduino and I'm not getting it, which pins should I use?
Wemos Mini model
See image below the wiring diagram on arduino.
Code
Wemos Mini model
See image below the wiring diagram on arduino.
Code
Code: Select all
#include <Stepper.h>
const int stepsPerRevolution = 500;
//Inicializa a biblioteca utilizando as portas de 8 a 11 para
//ligacao ao motor
Stepper myStepper(stepsPerRevolution, 8,10,9,11);
void setup()
{
//Determina a velocidade inicial do motor
myStepper.setSpeed(60);
}
void loop()
{
//Gira o motor no sentido horario a 90 graus
for (int i = 0; i<=3; i++)
{
myStepper.step(-512);
delay(2000);
}
//Gira o motor no sentido anti-horario a 120 graus
for (int i = 0; i<=2; i++)
{
myStepper.step(682);
delay(2000);
}
//Gira o motor no sentido horario, aumentando a
//velocidade gradativamente
for (int i = 10; i<=60; i=i+10)
{
myStepper.setSpeed(i);
myStepper.step(40*i);
}
delay(2000);
}