Arduino with cnc shield using .ino

first project and am trying to learn. My project goal is to run a stepper motor in a direction until it hits a limit switch, then reverse direction until it hits the next limit switch... that's it.. I'll control the speed in the software.. so no switches for that (as of now). First I built a breadboard and with a little help got it working.. motor runs :) and then I saw the cnc shield and thought.. that will be better than all these wires and breadboard in a box... so I purchased one.. moved my set up over to it and my motor doesn't move.. obviously.. I'm missing something. I don't need gcode or anything fancy.. just running the motor back and forth.. any guidance on this would be appreciated.

Welcome to the forum

Start by posting full details of the hardware being used, a schematic of your project and the full sketch that you are using. Use code tags when you post the sketch

// pin connections
const int dirPin = 2; // direction pin
const int stepPin = 3; // step pin

void setup() {
  pinMode(dirPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  // set direction of rotation to clockwise
  digitalWrite(dirPin, HIGH);
}

void loop() {
  // take one step
  digitalWrite(stepPin, HIGH);
  delayMicroseconds(2000);
  // pause before taking next step
  digitalWrite(stepPin, LOW);
  delayMicroseconds(2000);
}

At first glance, it looks as though you've plugged the motor connector in one position out of place...

Looking at the other headers, they all have 4 pins.

Your wire harness appears to have 4 wires.

So I'm in agreeement with @MicroBahner; for that circled pin to be visible, your connecter cannot be plugged in correctly.

These are the wrong pins for the CNC-Shield. For the X-Stepper you must use

const int dirPin = 5; // direction pin
const int stepPin = 2; // step pin

And by default all steppers are disabled at the CNC-Shield. You can enable them with a jumper at the EN/Gnd Pins ( next to the RST button ), or you can do it by software by setting pin 8 to LOW

// pin connections
const int dirPin = 5; // direction pin
const int stepPin = 2; // step pin
const int enaPin = 8;

void setup() {
  pinMode(dirPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(enaPin, OUTPUT);
  // set direction of rotation to clockwise
  digitalWrite(enaPin, LOW);
}

void loop() {
  // take one step
  digitalWrite(stepPin, HIGH);
  delayMicroseconds(2000);
  // pause before taking next step
  digitalWrite(stepPin, LOW);
  delayMicroseconds(2000);
}

[Edit:]
This is a picture of the pin usage:

@Van_der_decken... what a rookie mistake... I was so sure there must be a code issue because that's the area I know nothing about (well there was a code issue) but this is embarrassing. Thank you

@MicroBahner thank you as well.. I tried editing my code that way and didn't get anywere so I went back to what was working on the breadboard... that and the wiring error fixed my problem... now I can focus on learning the coding (or trying anyway)
Thank you too

you all rock

Are you using your breadboard setup again? I cannot imagine that your original sketch works with the CNC shield without any adjustment. The step/dir pins are different, and you need to enable the stepper. Ok,enabling the steppers can be donet per HW (the jumper). But adjusting the pins for step/dir is essential.

Hello everyone. I am working on a CNC project for PCB milling using a DC 775 motor spindle. I am experiencing a problem with the GRBL-Mega firmware that I downloaded from GitHub, as I am using a RAMPS 1.4 board with an Arduino Mega 2560. None of the NEMA 17 stepper motors are turning, even though the RAMPS board is correctly receiving commands from the control software Candle please help me