Finding a home position via hall-sensor

hi guys! :slight_smile:

i'm pretty new to the arduino-world, and also pretty new to programming...
after having successfully learned the hard basics, i now want to start my first 'real' project.
i tried to set a 'home-point' for a stepper-motor. for this i've been using a hall-sensor, which shouldn't be too hard i thought...
i used a 'do-while' loop in the void setup, which should run until the home position/magnet was detected.. from that point the real 'program' should start.
but the arduino doesn't even react to the hall sensor :frowning:
the problem isn't the sensor, since it is working perfectly in an other code. so it must be the coding...

here is the code i wrote:

#include <Stepper.h>
int SPMU = 32;
Stepper myStepper(SPMU, 6,7,8,9);



void setup() {


const int hallPin = 12;
int hallState = 0;
Serial.begin(9600);

myStepper.setSpeed(1000);


do {
  myStepper.step(-100);
  Serial.println("searching");
  delay(200);
} while(hallState == LOW);

if (hallState = HIGH) {
  Serial.println("found");
}

}



void loop() {

myStepper.step(-2458);
Serial.println("start programm");
delay(1000);

}

l've been searching the internet for days now, and would be soo grateful if somebody could help me!
thank you so much in advance!

pedro

do {
  myStepper.step(-100);
  Serial.println("searching");
  delay(200);
} while(hallState == LOW);

Don't you need to read the hall pin at some point?