Motor with hall effect sensor headaches...

Ok my mistake there, Pin 12 on the Arduino isn't PWM obviously... I have now corrected that to Pin 6~.

That's just controlling the motor speed, and works fine.

What I'm struggling with is the Case 1 part of the code. At the first push of the button the motor runs in one direction for 1000ms at a set speed and then turns off. Perfect.

The second button press starts the motor running indefinitely again that's fine. What I'm then trying to do is have the hall effect sensor stop the motor from spinning.