need help debugging!

Hi, I am very new to the language and need some help.

The program uses a step motor & should first look for a home switch, then reverse until it does a full cycle count.

#define HOME_PIN 1
#define STEP_PIN 2
#define DIR_PIN 3

bool dirHigh;

void setup()
{
dirHigh = true;
digitalWrite(DIR_PIN, HIGH);
digitalWrite(STEP_PIN, LOW);
pinMode(DIR_PIN, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
digitalWrite(HOME_PIN, HIGH);
pinMode(HOME_PIN, INPUT);
}

void loop()
{ int HOME_PIN = 1;
int val = 0;
}
if(HOME_PIN LOW)
{
digitalWrite(dir_Pin, HIGH);
}
void loop()
{
if(dirHigh)
{
dirHigh = false;
digitalWrite(DIR_PIN, LOW);
}
else
{
dirHigh = true;
digitalWrite(DIR_PIN, HIGH);
}

for(int i = 0; i < 50; i++)
{
digitalWrite(STEP_PIN, HIGH);
delay(250);
digitalWrite(STEP_PIN, LOW);
delay(250);
}
}

    if(HOME_PIN LOW)

Do you mean

   if(HOME_PIN == LOW)

Not that it will ever be LOW because you have just tried to set it HIGH with

int HOME_PIN = 1;

But, then again you have defined HOME_PIN as 1 so that will become
int 1 = 1;So it won’t compile anyway.

Have a look at planning and implementing a program. If you organize your code as a series of functions with meaningful names it will make life much easier.

For example

void setup() {

  // other stuff

 
}

void loop() {
   if (homeSet == false){
       moveToHomePosition();
   }
   // whatever
}

void moveToHomePosition() {
   homeSwitch = digitalRead(homeSwitchPin);
   if (homeSwitch == HIGH) {
      moveStep('L'); // assuming left is towards HOME
   }
   else {
     homeSet = true;
   }
}

void moveStep( char dir) {
  if (dir == 'L') {
    digitalWrite(dirPin, HIGH);
  }
  else {
    digitalWrite(dirPin, LOW);
  }
  digitalWrite(stepPin, HIGH);
  digitalWrite(stepPin, LOW);
}

See also Stepper Motor Basics and this simple stepper code

Welcome top the Forum. Please read the posting guidelines by Nick Gammon that appear at the top of this Forum, especially about using code tags for source code listings. It will help us help you.