The motor is connected via A4988. The voltage is set to 0.5V. The engine is: 17HS4401. I tried all combinations of cable connections. The engine shakes. The power supply for A4988 is 12V and 5A. What else can I do? Other engines respond the same. Im using ESP8266 with Wi-Fi.
// Pin Definitions
#define DIR_PIN D0
#define STEP_PIN D1
void setup() {
// Set pins as outputs
pinMode(DIR_PIN, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
}
void loop() {
// Set direction of movement
digitalWrite(DIR_PIN, HIGH); // Set movement direction in one direction
// Perform steps
for (int i = 0; i < 200; i++) { // 200 steps for full rotation (adjust as needed)
digitalWrite(STEP_PIN, HIGH); // Send step pulse
delayMicroseconds(500); // Wait for the motor to complete the step
digitalWrite(STEP_PIN, LOW); // End step pulse
delayMicroseconds(500); // Wait before sending the next pulse (adjust speed as needed)
}
delay(1000); // Wait for 1 second before changing direction
// Change direction of movement
digitalWrite(DIR_PIN, LOW); // Change movement direction in the other direction
// Perform steps
for (int i = 0; i < 200; i++) { // 200 steps for full rotation (adjust as needed)
digitalWrite(STEP_PIN, HIGH); // Send step pulse
delayMicroseconds(500); // Wait for the motor to complete the step
digitalWrite(STEP_PIN, LOW); // End step pulse
delayMicroseconds(500); // Wait before sending the next pulse (adjust speed as needed)
}
delay(1000); // Wait for 1 second before next loop iteration
}