Hallo zusammen
Ich habe folgende Teile verbaut
Arduino Nano
Treiber A4988
Schrittmotor 17HS4401
Potentiometer
Nun Dreht mein Motor bei einer bestimmten Poti Stellung. Sobald das Poti verstellt wird, vibriert und summt der Motor nur.
Was muss ich ändern?
const int dirPin = 2;
const int stepPin = 3;
const int potPin = A0;
void setup() {
pinMode(dirPin, OUTPUT);
pinMode(stepPin, OUTPUT);
digitalWrite(dirPin, HIGH); // Drehrichtung
}
void loop() {
int potValue = analogRead(potPin);
int delayTime = map(potValue, 0, 1023, 2000, 100); // Geschwindigkeit steuern
digitalWrite(stepPin, HIGH);
delayMicroseconds(delayTime);
digitalWrite(stepPin, LOW);
delayMicroseconds(delayTime);
}