Hello every one, post here a new idea or even not new

I want to have a stepper motor controlled by two potentiometers, one for speed control, and another one used to control the position of the motor, the position control no need accurate, can be by time , say read a pot value and set to a relatively seconds for the motor to run, it is good enough for me now.

need help or are there any similarly example?


I'd start by looking at the stepper_speed_control example that comes with the Stepper library (File->Examples->Stepper->stepper Speed Control).

That is example gets you halfway there...

Using a stepper motor, let the second pot represent the number of steps to go! That will give You beautiful moves, exact stopping position.
Your question is actually not exactly usual considering the details.
First, learn how to make a stepper run, how to make a controlled number of steps. Then experiment with time between steps to select different speeds. Reading a pot and applying some math calculating step delay resp. number of steps should not be difficult.
Make it step by step!

If you want to be able to control the speed while the motor is moving then have a look at the second (non-blocking) example in this Simple Stepper Code

When you say "control the position of the motor", what exactly do you mean? For example do you want the stepper motor to follow the position of the potentiometer?

Stepper Motor Basics

Thanks for all participants.
I got the following sketch with some body’s help which did exactly what I need.

#include <Stepper.h>

#define STEP_FRAC 1
#define STEP_COUNT 100
Stepper myStepper(400, 8, 9, 10, 11);
int stepCount = 1;  // number of steps the motor has taken
bool clockwise = true;
int movedis = 0;

void setup() {

void loop() {

  int sensorReading = analogRead(A0); 
  int motorSpeed = map(sensorReading, 0, 1023, 0, 100);  
  int circleReading = analogRead(A1); 
  int circle = map(circleReading, 0, 1023, 0, 100); 

  movedis = circle;
  myStepper.step(movedis * (clockwise ? 1 : -1));
  if (stepCount++ >= STEP_COUNT) {
    stepCount = 1;
    clockwise = !clockwise;