# Hi guys, need help with code for stepper motor and keeps coming up with stepper not in library

**URL:** <https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266>\
**Category:** Programming\
**Created:** [August 9, 2024, 7:03pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266 "2024-08-09T19:03:37Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![lukeharry101](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/lukeharry101/32/1098908_2.png) [@lukeharry101](https://forum.arduino.cc/u/lukeharry101)\
**Post date:** [August 9, 2024, 7:03pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/1 "2024-08-09T19:03:37Z")

</div>

Continuing the discussion from [About the Programming Questions category](https://forum.arduino.cc/t/about-the-programming-questions-category/847460):

Hey guys, need help with me trying out a stepper, it keeps saying can not find stepper in library, wondering if anyone could help thanks a bunch

---

<div class="post-metadata">

**Author:** ![kolaha](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kolaha/32/966427_2.png) [@kolaha](https://forum.arduino.cc/u/kolaha)\
**Post date:** [August 9, 2024, 7:40pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/2 "2024-08-09T19:40:19Z")

</div>

try harder. some day it will give up and then find stepper.

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [August 9, 2024, 7:40pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/3 "2024-08-09T19:40:59Z")

</div>

Please show your code and error code so we can tell which stepper library you are trying to use.

> [@Best first 5 topics to read to reach Trust Level 1?](https://forum.arduino.cc/t/best-first-5-topics-to-read-to-reach-trust-level-1/1287592/1):
>
> - [How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966) by @PerryBebbington -- to learn how to post productive questions.

You may need to try this:

[https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-installing-a-library/](https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-installing-a-library/)

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [August 9, 2024, 8:04pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/4 "2024-08-09T20:04:25Z")

</div>

No such message. Screen grabs only.

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [August 10, 2024, 3:13am UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/5 "2024-08-10T03:13:47Z")

</div>

> [@lukeharry101](#):
>
> can not find stepper in library

Your error was probably...

```arduino
Stepper.h not found in library

```

To resolve this, use your IDE to find TOOLS \>\> INCLUDE LIBRARIES \>\> MANAGE LIBRARIES then enter Stepper... you will see Stepper by Arduino... click "install" and when it is complete, try compiling your sketch again.

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [August 10, 2024, 1:00pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/6 "2024-08-10T13:00:50Z")

</div>

You are working on an informatic project.And what is needed most in an informatic project is **information**.

> [@Make experienced users help: two ways to quickly post code as a code-section](https://forum.arduino.cc/t/make-experienced-users-help-two-ways-to-quickly-post-code-as-a-code-section/937298/1):
>
> Hi newcomer, This thread wants to show you how you can speed-up getting helpful answers with small effort. If you manage at least to post this way. You have the sympathy of the experienced users. If you are willing to invest another 20 minutes these 20 minutes extra-time will save you a minimum of 200 minutes to finish your project. always post your full sketch. As a code-section from the very first to the very last line A code-section has a small height =\> keeps your posting "short" but e…

---

<div class="post-metadata">

**Author:** ![lukeharry101](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/lukeharry101/32/1098908_2.png) [@lukeharry101](https://forum.arduino.cc/u/lukeharry101)\
**Post date:** [August 11, 2024, 4:49pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/7 "2024-08-11T16:49:08Z")

</div>

Thanks very much for answering,

 ![Screenshot (244)](https://europe1.discourse-cdn.com/arduino/original/4X/d/b/a/dba689b3f10902dd68bde85789818b8d4bc7b7fe.png)

I'm using a KeyeStudio:

- motor is a 28BYJ-48
- driver ULN2003

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [August 11, 2024, 6:12pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/8 "2024-08-11T18:12:28Z")

</div>

Your error is pointing to the extra "motorspeed" inside the parenthesis on line 7.

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [August 11, 2024, 7:43pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/9 "2024-08-11T19:43:15Z")

</div>

You didn't posted your sketch as a

## code-section

It is seen as a very bad habit on this forum to post screenshots.

Seems you want to play a snapchat short messages ping-pong game of  
posting a single sentence waiting for a single-sentence answer.

Sure if you like this way. Making your code run will take weeks.

I'm pretty sure that you agree and will follow the way how to solve your problem mimimum 200 minutes **faster**.  
This requires to **invest** 20 minutes of your precious time to read how to speedup solving your problems.

Directly after registering you got presented informations how to speed up solving your problem.  
You should really read it.

> [@How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966):
>
> See also [FAQ - Arduino Forum](https://forum.arduino.cc/faq) for general rules on forum behavior and etiquette. Hello, Welcome to the Arduino Forum. This guide explains how to get the best out of this forum. Please read and follow the instructions below. Being new here you might think this is having rules for the sake of rules, but that is not the case. If you don’t follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is frus…

best regards Stefan

---

<div class="post-metadata">

**Author:** ![lukeharry101](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/lukeharry101/32/1098908_2.png) [@lukeharry101](https://forum.arduino.cc/u/lukeharry101)\
**Post date:** [August 12, 2024, 12:10am UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/10 "2024-08-12T00:10:58Z")

</div>

I'll be very Direct and say I Struggle With my Traumatic Brain injury from an accident and cant route my learning to learn as I used to.. it won't seam like it with the way I write, I do rely on people a lot, please dont bother to accuse me of "trying to play "snap-chat ping pong games games" and if that seams to bother you, I have no apology for you, as that is a you problem not a me problem. but if you're wiling to understand then we are on mutual ground, on which I'm thankful. I will Try my best to learn the link which you have attached but as I very slowly do so I will very much so probaly continue(at my best minimum) continue to over ask this way, I don't know weather to apologise for that or not?

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [August 12, 2024, 1:16am UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/11 "2024-08-12T01:16:30Z")

</div>

> [@lukeharry101](#):
>
> apologise for that or not

Not.

Pro-tip: If you are tired of hearing from someone, (1) in the upper-right of the page (2) mouse-click your avatar (3) click "profile" (4) click "preferences" (5) click "users"... you will see (6) ignore and (7) mute. You can "un-see" anyone you choose by selecting their username.

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [August 12, 2024, 4:17pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/12 "2024-08-12T16:17:06Z")

</div>

Check answer #8 and the syntax of the line that the compiler highlighed in the screenshot you posted.

What do you expect that line to do?

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [August 14, 2024, 3:29pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/13 "2024-08-14T15:29:19Z")

</div>

My eyes suck and I can barely read the code and error in your post #8.

If, instead of a screenshot of the code, you cut and pasted the actual code and error message, it would help folks help you.

If I squint hard, it looks like this line is ill formed:

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/e/7/c/e7c8d6584a30b569c793b4dadf7ff9bbc2206beb.png)

It looks like `myStepper.setSpeed(motorSpeed 20);` is confusing things. I'd try either

```arduino
myStepper.setSpeed(motorSpeed);`

```

or

```arduino
myStepper.setSpeed(20);`

```

depending on what you are trying to accomplish.

Do you have an `#include <stepper.h>` line in there somewhere? Try proven code from the  
examples in File/Examples/Stepper/

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [August 14, 2024, 4:13pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/14 "2024-08-14T16:13:40Z")

</div>

> [@lukeharry101](#):
>
> I'll be very Direct and say I Struggle With my Traumatic Brain injury from an accident and cant route my learning to learn as I used to..

Very important information to understand your situation.  
I am sorry if my former post offended you.

So shall your code be a simple test if the stepper-motor runs?

If you follow this click-path  
file - examples - stepper - one revolution

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/f/2/0/f2005a496c80cc4adc5d53c0146111b206ac3cff.png)

you will find this demo-code

```arduino

/*
 Stepper Motor Control - one revolution

 This program drives a unipolar or bipolar stepper motor.
 The motor is attached to digital pins 8 - 11 of the Arduino.

 The motor should revolve one revolution in one direction, then
 one revolution in the other direction.

 Created 11 Mar. 2007
 Modified 30 Nov. 2009
 by Tom Igoe

 */

#include <Stepper.h>

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
  // set the speed at 60 rpm:
  myStepper.setSpeed(60);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution in one direction:
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(500);

  // step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(500);
}

```

to make your stepper-motor rotate.

Did you do compile and upload some other basic codes?  
Like blinking the onboard LED?

---

<div class="post-metadata">

**Author:** ![lukeharry101](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/lukeharry101/32/1098908_2.png) [@lukeharry101](https://forum.arduino.cc/u/lukeharry101)\
**Post date:** [September 23, 2024, 11:38pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/15 "2024-09-23T23:38:30Z")

</div>

ahh Thank you so muchly, I'm in and out of hospital haha and have brought quite litrally have about $300 worth of hardware with me for the next week! lets see what can ve made!

I'll s

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [March 22, 2025, 11:38pm UTC](https://forum.arduino.cc/t/hi-guys-need-help-with-code-for-stepper-motor-and-keeps-coming-up-with-stepper-not-in-library/1290266/16 "2025-03-22T23:38:43Z")

</div>

Closed on March 22, 2025, 11:38pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
