Go Down

Topic: Increase Stepper Motor Speed (Read 9 times) previous topic - next topic


yeah i looked at that im not clever enough to swap out 8,9,10,11 pins with steppin and directionpin with out it saying stepper not ....whatever


So post the code as you have changed it, along with the error message and some one will tell you where you have gone wrong.
When posting code, select it and then hit the # icon in the reply box before posting.


Code: [Select]
#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 200
#define directionPin 22
#define stepPin 24
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to

// the previous reading from the analog input
int previous = 0;

void setup()
  // set the speed of the motor to 30 RPMs

void loop()
  // get the sensor value
  int val = analogRead(0);

  // move a number of steps equal to the change in the
  // sensor reading
  stepper.step(val - previous);

  // remember the previous value of the sensor
  previous = val;

there it is I told you I am simple the error code it gives me is stepper was not declared in this scope motorknob.cpp: in function void loop
etc. it gets very angry at me


You need this line:-
Code: [Select]
Stepper stepper(STEPS, 8, 9, 10, 11);
In order to tell the software what pins to use. Change the numbers to match the pins your hardware is using.

Without this line the software doesn't know what the word 'stepper' means and so it tells you it doesn't know with the error message "not declared in scope" which means "WTF no on told be about this word stepper, I don't know what to do with it.

Go Up