//Геворкян Михаил, 2025
// ПростойЦикл. Хотя дост-ноПростоBLINK(см.Мой,+С_Углами).
const int dirPin = 12; const int stepPin = 13;
const int stepPerRevolution = 2000;
void setup() { pinMode(dirPin,OUTPUT); pinMode(stepPin,OUTPUT); }
void loop() { digitalWrite(dirPin, HIGH);
for (int x=0; x < stepPerRevolution; x++) {
digitalWrite(stepPin, HIGH); delay(25); // delayMicroseconds(200);
digitalWrite(stepPin, LOW); delay(25); // delayMicroseconds(200);
} delay (5000);
}
// Альтернатива, пины те же, смена направления вращения
/*const int stepPin = 13;
const int dirPin = 12;
void setup() { pinMode(stepPin, OUTPUT); pinMode(dirPin, OUTPUT); }
void loop() {
digitalWrite(dirPin, HIGH); // Направление вращения
for(int x = 0; x < 200; x++) { //200 импульсов
digitalWrite(stepPin, HIGH); delay(50);
digitalWrite(stepPin, LOW); delay(50);
} delay(1000);
digitalWrite(dirPin, LOW); //Меняем направление вращения
for(int x = 0; x < 400; x++) { //(?)200 импульсов на один оборот
digitalWrite(stepPin, HIGH); delay(25);
digitalWrite(stepPin, LOW); delay(25); }
delay(1000); } */