// Define control pins for stepper motor
#define STEP_PIN 16
#define DIR_PIN 17
// Number of steps per one full revolution
const int stepsPerRevolution = 200;
void setup() {
// Set the step and direction pins as outputs
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
// Set initial direction to clockwise
digitalWrite(DIR_PIN, HIGH);
}
void loop() {
// Rotate motor clockwise
for (int i = 0; i < stepsPerRevolution; i++) {
digitalWrite(STEP_PIN, HIGH); // Step HIGH
delayMicroseconds(1000); // Control speed
digitalWrite(STEP_PIN, LOW); // Step LOW
delayMicroseconds(1000);
}
delay(1000); // Wait 1 second
// Change direction to counter-clockwise
digitalWrite(DIR_PIN, LOW);
// Rotate motor counter-clockwise
for (int i = 0; i < stepsPerRevolution; i++) {
digitalWrite(STEP_PIN, HIGH); // Step HIGH
delayMicroseconds(1000); // Control speed
digitalWrite(STEP_PIN, LOW); // Step LOW
delayMicroseconds(1000);
}
delay(1000); // Wait 1 second before repeating
}
esp:0
esp:2
esp:4
esp:5
esp:12
esp:13
esp:14
esp:15
esp:16
esp:17
esp:18
esp:19
esp:21
esp:22
esp:23
esp:25
esp:26
esp:27
esp:32
esp:33
esp:34
esp:35
esp:3V3
esp:EN
esp:VP
esp:VN
esp:GND.1
esp:D2
esp:D3
esp:CMD
esp:5V
esp:GND.2
esp:TX
esp:RX
esp:GND.3
esp:D1
esp:D0
esp:CLK
drv1:ENABLE
drv1:MS1
drv1:MS2
drv1:MS3
drv1:RESET
drv1:SLEEP
drv1:STEP
drv1:DIR
drv1:GND.1
drv1:VDD
drv1:1B
drv1:1A
drv1:2A
drv1:2B
drv1:GND.2
drv1:VMOT
stepper1:A-
stepper1:A+
stepper1:B+
stepper1:B-