Hi i'm starting my first arduino project and i'm doing it in stages with the first stage being just getting a stepper motor working.
#define directionPin 2
#define stepPin 3
#define stepsPerRevolution 6400
void setup() {
// put your setup code here, to run once
pinMode(directionPin, OUTPUT);
pinMode(stepPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
for (int i = 0; i < stepsPerRevolution; i++) {
digitalWrite(directionPin, LOW);
digitalWrite(stepPin, HIGH);
delayMicroseconds(50);
digitalWrite(stepPin, LOW);
delayMicroseconds(50);
}
}
Thats my code and I get no errors when I upload it to my arduino.
You can post picture directly from the clipboard into the web-editor
As far as I can see from your picture you haven't connected ground of the arduino with ground of the stepper-driver.
You should use the standardised colors:
ground / minus black or blue
+5V red
+12V (or whatever) a different color than red but similar to red (orange, pink, violet)
signals not black, blue or red
This will make it easier to check the wiring.
For driving stepper-motors I recommend to use the library mobatools
You can install this library from the library-manager of the Arduino-IDE
You cannot expect a stepper motor to go from a dead stop to 10,000 steps per second instantly. I suggest that for testing to set the delays to 10 milliseconds or more to see if the motor will move.
High speeds require acceleration. The built in Stepper library will not do acceleration. I like the MobaTools stepper library. It does acceleration and is relatively easy to learn and use.
Are you sure that the EN+input is LOW-active?
Do you have a datasheet or a user-manual for the stepper-driver?
What does the steper-driver-manual say?
Your schematic has no powersupply for the motor connected.
If you post a schematic the schematic should represent ALL details of your real hardware.
Without a power-supply here