Stepper vibrating instead of turning

Hi all,

I am wondering if you experienced eyes could take a look at what I'm doing and help me identify my problem. I bought this set of products with the intent of controlling 4 stepper motors in tandem for a personal project: https://www.amazon.com/gp/product/B07JV835SW/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&th=1

I am trying to get a motor spinning, but all it does is vibrate. The code I'm using is shown below.

const int stepPin = 60; 
const int dirPin = 61; 
const int enablePin = 56; 
 
void setup() {
  pinMode(stepPin,OUTPUT); 
  pinMode(dirPin,OUTPUT);
  pinMode(enablePin,OUTPUT);

  digitalWrite(enablePin,LOW);



  digitalWrite(dirPin,HIGH);
  for(int x = 0; x < 200; x++) {
    digitalWrite(stepPin,HIGH); 
    delayMicroseconds(500); 
    digitalWrite(stepPin,LOW); 
    delayMicroseconds(500); 
  }
  delay(1000); // One second delay
  
  digitalWrite(dirPin,LOW); //Changes the rotations direction
  for(int x = 0; x < 400; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(500);
  }
  delay(1000);
}


void loop() {
}

So far I have tried playing with motor wire positions and tried it on a different computer. The wiring of the RAMPS board is shown in the link here: Imgur: The magic of the Internet. Does anyone see any errors that I have missed? If not, what are the recommended troubleshooting steps from this point?

Thanks!
Eric

Have you tried a much slower step rate? Start with (say) 2 steps per second.

...R
Stepper Motor Basics
Simple Stepper Code

if the stepper motor is not-wired correctly, the sequence is wrong and it moves somewhat back and forth.
you can see this if you move one step at a time

Thanks everyone! Robin, that was the golden ticket. In full-step mode I can support a step delay of down to 2[ms], but 1[ms] causes the motor to not spin. I will look into AccelStepper for acceleration commands when trying to run higher speeds.

Glad I asked!

Firstly don't use full-step mode if at all possible, horrible amounts of vibration and resonance will plague things.

x8 to x16 microstepping are reasonable options to start with, try them out.

Except for really tiny steppers or very slow speeds you absolutely need speed-ramping such as the
AccelStepper library provides. The only stepper I've seen that can jump stright to full speed is 5mm
in diameter and 6mm long....