control stepper motor forward n reverse using LV-MaxSonar-EZ1 control motor

now i can move my stepper forward n reverse using arduino, i blur how to control stepper to start n stop to move forward using LV-MaxSonar-EZ1 and start n stop to move reverse using sensor...can help me

Read the sensor.
Decide whether to move the motor.
Move the motor.

It seems easy enough - what's the problem?

elaborate your problem!!!!

sorry newbi now i use pin 8 and 10 to move stepper forward reverse using below coding

#include <Stepper.h>

#define motorSteps 200 // change this depending on the number of steps
// per revolution of your motor
#define motorPin1 8
#define motorPin2 10
#define ledPin 13

// initialize of the Stepper library:
Stepper myStepper(motorSteps, motorPin1,motorPin2);

void setup() {
// set the motor speed at 300 RPMS:
myStepper.setSpeed(300);

// Initialize the Serial port:
Serial.begin(9600);

// set up the LED pin:
pinMode(ledPin, OUTPUT);
// blink the LED:
blink(3);
}

void loop() {

// Step backward 60000000 steps:
Serial.println("Backward");
myStepper.step(-34000);
delay(10);

// Step forward 60000000 steps:
Serial.println("Forward");
myStepper.step(34000);
delay(10);

}

// Blink the reset LED:
void blink(int howManyTimes) {
int i;
for (i=0; i< howManyTimes; i++) {
digitalWrite(ledPin, HIGH);
delay(2);
digitalWrite(ledPin, LOW);
delay(2);
}
}

now i want use LV-MaxSonar-EZ1 so connection +5 to 5v , gnd to gnd, pw to pin 7....my problem is how to make coding to move motor using sensor example i want set distance 3cm so i want motor move n stop 3cm if more motor movement will move forward until 3cm and stop
i blur

I'm old so I don't understand what "I blur" means. You have used it twice so I guess its not a typo.

Anyway, that's not important ...

I suggest you put your motor code to one side for a little while and write a short sketch that gets the data from the sensor and displays it on the screen. That will allow you to see what numbers you get for various distances.

Then I suggest you modify your stepper code so it will respond to different values as if they had come from the sensor.

After that it should be fairly easy to build all the code into a single sketch.

...R