Steppermotor must do something on a certainpossition (solved)

My steppermotor must do something on a certainpossition.

I am using the sketch from Michael Schoeffler 2017.

My steppermotor is a 28BJY-48

If my steppermotor reaches the possition 1000, I want that a light goes on.

But if I uses the following IF statements

if (stepper.steps(1000)
{
(digitalWrite led, HIGH);
}

Nothing happens.

Greetings

Please include your full sketch as placement of an IF statement could be the problem and people need to understand how and where you call it.

Could you also take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.
Other general help and troubleshooting advice can be found here.

I have a found a sollution for my problem.
Zo this tread can be closed.

Can we ask what your solution was as it may benefit other with a similar issue ?

The steppermotor had 8000 steps to go. On steps 1000 I want a led to go on.

Solution

I divided the steps into two different steps

stepper.step (1000); // steppermotor go for the first 1000 steps then it will stops
digitalWrite(led,HIGH); // led goes on after 1000 steps
stepper.step (7000); // steppermotor continues the rest of the steps.

I thought that the steppermotor should stop at position 1000 but that is not so. Or it not visable.

So problem solved.

I don't know how to shut down this thread, will you do it for me, thanks.

I will mark it as SOLVED for you.