// Ejemplo.01 Controlar un motor paso a paso
//1.Definir los pines
//int-->valores enteros
const int dirPin = 3;
const int stepPin = 2;
//Definir variables
const int stepPerRevolution = 2000;
void setup() {
// put your setup code here, to run once:
//OUTPUT--> salida
pinMode(dirPin,OUTPUT);
pinMode(stepPin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(dirPin, HIGH);
for (int x=0; x < stepPerRevolution; x++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(200);//Tiempo esta definido en microsegundos
digitalWrite(stepPin, LOW);
delayMicroseconds(200);//Tiempo esta definido en microsegundos
}
delay (5000); // 5 segundos
}