probleme with stepper

hey peopel i have a problem with stepper motor i cant stop it with a code

Hi mhamed213 welcome to the forum.
Tell us which motor you have.
Post your code. Use code tags.

As a new forum member, you might not have read through the forum guidelines.
It will help you if you do. They are here How to use this forum - please read

the stepper (motor 28by-48)

#include <CheapStepper.h>

// next, declare the stepper
// and connect pins 8,9,10,11 to IN1,IN2,IN3,IN4 on ULN2003 board

CheapStepper stepper (8,9,10,11);

// let’s create a boolean variable to save the direction of our rotation
//int digitalPin = 8;
//int digitalPin = 9;
//int digitalPin = 10;
//int digitalPin = 11;
boolean moveClockwise = true;

int led = 13 ; // LED on arduino
int digitalPin = 3; // linear Hall magnetic sensor digital interface
int analogPin = A0; // linear Hall magnetic sensor analog interface
int digitalVal ; // digital readings
int analogVal; // analog readings
int stepperPin1 = 8;
int stepperPin2 = 9;
int stepperPin3 = 10;
int stepperPin4 = 11;

void setup() {

// let’s set a custom speed of 20rpm (the default is ~16.25rpm)
// pinMode (led, OUTPUT);
pinMode (digitalPin, INPUT);
pinMode(analogPin, INPUT);
// stepper.setRpm(20);

/* Note: CheapStepper library assumes you are powering your 28BYJ-48 stepper

  • using an external 5V power supply (>100mA) for RPM calculations
  • – don’t try to power the stepper directly from the Arduino
  • accepted RPM range: 6RPM (may overheat) - 24RPM (may skip)
  • ideal range: 10RPM (safe, high torque) - 22RPM (fast, low torque)
    */

// now let’s set up a serial connection and print some stepper info to the console

/* you can uncomment the above line if you think your motor

}

void loop() {

digitalVal = digitalRead(digitalPin) ;
if (digitalVal == LOW)
{
stepper.moveDegrees (moveClockwise,80);

delay(1000);

digitalWrite(stepperPin1,LOW );
digitalWrite(stepperPin2,LOW );
digitalWrite(stepperPin3,LOW );
digitalWrite(stepperPin4,LOW );

}

if (digitalVal == HIGH)
{

moveClockwise = !moveClockwise; // reverse direction
stepper.moveDegrees (moveClockwise, 180);
delay(1000);

// and now let’s move another 90 degrees (a quarter-turn) clockwise

} }

Even after being ask, nicely, to read the forum guidelines you post badly formatted code without code tags. How do we know that if we take the time to write helpful responses that you will not ignore them, too?

Why not try the regular Stepper library that people here will be familiar with. Or the AccelStepper library if you need the extra functionality.

There are dozens of Forum Threads about 28BYJ-48 stepper motors - have you looked at any of them?

...R