Go Down

Topic: sketch error ?? help (Read 529 times) previous topic - next topic


i got this sketch off the net it shows the stepper working but when i upload the sketch i get errors

// accellsteppertest.ino
// Runs one stepper forwards and backwards, accelerating and decelerating
// at the limits. Derived from example code by Mike McCauley
// Set for 28BYJ-48 stepper

#include <AccelStepper.h>

#define FULLSTEP 4
#define HALFSTEP 8

//declare variables for the motor pins
int motorPin1 = 8;   // Blue   - 28BYJ48 pin 1
int motorPin2 = 9;   // Pink   - 28BYJ48 pin 2
int motorPin3 = 10;   // Yellow - 28BYJ48 pin 3
int motorPin4 = 11;   // Orange - 28BYJ48 pin 4
                       // Red    - 28BYJ48 pin 5 (VCC)

// The sequence 1-3-2-4 required for proper sequencing of 28BYJ48
AccelStepper stepper2(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);

void setup()

void loop()
 //Change direction at the limits
 if (stepper2.distanceToGo() == 0) {

errors are
sketch_sep18c:18: error: 'AccelStepper' does not name a type
sketch_sep18c.cpp: In function 'void setup()':
sketch_sep18c:22: error: 'stepper2' was not declared in this scope
sketch_sep18c.cpp: In function 'void loop()':
sketch_sep18c:31: error: 'stepper2' was not declared in this scope
sketch_sep18c:34: error: 'stepper2' was

thanks marko

Tom Carpenter

have you downloaded the AccelStepper library?

Tom Carpenter

Well theres your problem then. Your sketch can't use code that you haven't provided it.
Notice this line:
#include <AccelStepper.h> 

The library can be found here:


ahhhh got it now but where do i put the <AccelStepper.h> ?

Tom Carpenter


Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

shortcuts: alt+s submit/post or alt+p preview