Herunterladen Inhalt Inhalt Diese Seite drucken

AZ-Delivery A4988 Bedienungsanleitung Seite 17

Inhaltsverzeichnis

Werbung

Arduino-Code:
uint8_t
stepPin = 2;
uint8_t
dirPin = 3;
int
steps = 1000;
int
usDelay = 950;
void
setup() {
Serial.begin(9600);
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void
loop() {
digitalWrite(dirPin, HIGH);
for(int
x = 0; x < steps; x++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(usDelay);
digitalWrite(stepPin, LOW);
delayMicroseconds(usDelay);
}
delay(1000);
digitalWrite(dirPin, LOW);
for(int
x = 0; x < steps; x++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(usDelay);
digitalWrite(stepPin, LOW);
delayMicroseconds(usDelay);
}
delay(1000);
}
// you should increase this if you are using
// some of microstepping modes
// minimal is 950 for full step mode and NEMA15 motor
// minimal is 35 for sixteenth step mode
// motor direction cw
// motor direction ccw

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis