step dir motor and speed control without library

Robin2:

copachino:
im almost like copy-page from the igor code on the exmples, and the example compiles ok, but mine have this problem in the setup its not declared nothing on the original code, so maybe my lib its wrong??

I don't understand.

Did you read my Reply #7 ?
Did you try my suggestions?

...R

ys i tried, but mystepper. its somethingon the Stepper.h library, so i doesnt need to be declared, i am calling stepper.h lib but doesnt work on this code, im trying to just implement the stepper speed control with a potenciometer that its on the data base of steppers examples. but software keeps asking to declare Mystepper function.

this its my code:

#include <configMe.h>

#include <Stepper.h>


#define MI_PIN_STEP 5
#define MI_PIN_DIR 2
const int  gir = 10;   
const int stepsPerRevolution = 200;
int stepCount = 0;

void setup() 
{
  //Wire.begin ();
  Serial.begin ( 57600 );
  
  pinMode ( MI_PIN_STEP, OUTPUT );
  pinMode ( MI_PIN_DIR, OUTPUT );
  
  pinMode(gir,INPUT);
  
  
 
 

  
}

void loop()
{
  
  int sensorReading = analogRead(A0);
  int motorSpeed = map(sensorReading, 0, 1023, 0, 100);
  
  if (motorSpeed > 0) {
    myStepper.setSpeed(motorSpeed);
    // step 1/100 of a revolution:
    myStepper.step(stepsPerRevolution /200);
  }
  
  
 // {

if(gir==HIGH)
 {
  digitalWrite ( MI_PIN_DIR, HIGH ); 

}
  if(gir==LOW)
  {
 digitalWrite ( MI_PIN_DIR, LOW ); 
}
 
  // pasos
  digitalWrite ( MI_PIN_STEP, LOW );
  
  digitalWrite ( MI_PIN_STEP, HIGH );

and this its the one on the examples

#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);

int stepCount = 0;  // number of steps the motor has taken

void setup() {
  // nothing to do inside the setup
}

void loop() {
  // read the sensor value:
  int sensorReading = analogRead(A0);
  // map it to a range from 0 to 100:
  int motorSpeed = map(sensorReading, 0, 1023, 0, 100);
  // set the motor speed:
  if (motorSpeed > 0) {
    myStepper.setSpeed(motorSpeed);
    // step 1/100 of a revolution:
    myStepper.step(stepsPerRevolution / 100);
  }
}

as you see mystepper doesnt need to be declared, but i dont know why the compliler keeps asking to declare it