arduino pot with motor programming

i connected motor to potentiometer which rotate pot...
and pot connected to to arduino analog pin..
i want program like,
when i enter value (like 0 to 255) ,motor should stops on tht value(which rotating pot)
plz help

What have you tried ?

Can you read the value from the pot ?
How is the motor powered ?

motor axis connected to pot axis,when motor rotats ,pot also rotate

pot connected to analog pin and motor with driver connected to digital pins of arduino..
suppose i enter any values between 0 to 255,like a=200,
then motor should rotate and stops when pot value become 200..

So, you have no idea where the motor and pot are initially so let’s deal with that first.

In setup() move the motor for a short time then read the value from the pot. Keep doing that until the pot value does not get any lower. Now we know that the pot is at one end of its travel.

To move to another angle you need to do something similar. You cannot rely on running the motor for a specific time to move to a given angle but you can move a little then read the pot and keep going until the pot value indicates that you have reached the required angle.

How do you know what pot value equates to which angle ?
Well, analogRead() should return between 0 and 1023 (1024 steps) when the wiper moves from one end to the other (but see later). So, if the pot moves say 270 degrees from end to end then the value returned by analogRead() will be 1024/270 for each degree.

If you start at a known position, say zero, and need to move say 84 degrees then you need to move until analogRead() returns (84 * 1024)/270

NOTE :
The analogRead() range may be less than 0 to 1023 so the calculation will need to be adjusted
Unless you always start from zero you will need to determine whether to move the motor forwards or backwards to reach the desired position.

Are you with this so far ?
Do you know how to read the pot ?
Do you know how to move the motor in either direction ?
You did not answer how the motor is powered but it should not be powered from the Arduino.

motor is powerd by l293d motor driver..and i can read values of pot..no angle and direction issu..
actully i made one soft which gives reading from 0 to 255 ,and this values readed by arduino by serial cammu..
so when i enter value betwn 0 to 255 ,arduino read this valu..and it rotates motor ,ant it rotats pot ..
now arduino reads the pot value first and then compare with my entered value..
suppose i enter value 200, and pot value is 230 then it rotates motor in one direction ,or if pot value is less than entered value..then it rotats motor in other direction..(thts depends on my connection of motor),

so when motor rotates pot and when pot reach to entered value,motor shouled stops completely and came out of loop..

const int analogInPin = A0;
int sv = 0, ov;

int val=100; ///value from software (but i took manually)

void setup() {
pinMode(8, OUTPUT); // motor driver
pinMode(10, OUTPUT); //motor driver
//Serial.begin(9600);
}

void loop() {

sv = analogRead(analogInPin); //pot value
ov = map(sv, 0, 1023, 0, 255); // mapiing pot value to 0 to 255

if (val==ov) //compareing entered value(val) with pot mapped value
{
digitalWrite(8, 0);//if both value same motor stop
digitalWrite(10, 0);//
}

if (ov>val) //when pot value is greater than entered value
{

while(val==ov)
{
digitalWrite(8, 1); // in one direction
digitalWrite(10, 0); //

delay (5);

digitalWrite(8, 0); // small delay and stop motor
digitalWrite(10, 0); //

}
}

if (ov<val) ////when pot value is less than entered value
{

while(val==ov)
{
digitalWrite(8, 0); // in other direction
digitalWrite(10, 1);

delay (5);

digitalWrite(8, 0); ///stops after small delay
digitalWrite(10, 0);

}
}

}

    if (ov>val)  //when pot value is greater than entered value
  {
   
     while(val==ov)
     {
   digitalWrite(8, 1);   // in one direction
   digitalWrite(10, 0);  //
   
   delay (5);
   
    digitalWrite(8, 0);  // small delay and stop motor
   digitalWrite(10, 0);  //
   
     }
  }

If ov is greater than val, do some stuff while they are equal. How likely is that stuff to ever happen?

If that stuff DID happen, what would cause the while loop to end?

when ov is greater than val or less than val i rotate pot using motor,,
in while loop i giving small positive pulse to motor so it takes small step ,while it reaches to val....
when it reaches to val it comes out of while loop..

when ov is greater than val or less than val i rotate pot using motor,,

No, you don't. If ov is greater than val, the while loop is NOT executed.

when it reaches to val it comes out of while loop..

How? You do not read the motor position or the pot anywhere in the while loop.

motor is powerd by l293d motor driver..

Where does the power actually come from ?

arduino read th pot value, and compare entered value, and
which power u talking about..do u know l293d motor driver ,it uses 12v to rotat the motor,it connect to arduino digital pin 8 and 10

u know servo motor in which inbuilt pot is there, from which we get 0to180 degree,,
same im doing ,i connected pot to normal dc motor

it uses 12v to rotat the motor

Hooray ! Finally a partial answer. At least we now know that the motor is not powered by the Arduino.

arduino read th pot value, and compare entered value,

Did you take note of Paul's observations in post #9 ? If you are so sure that the while loop is being executed then print something from within it. Do you see the output you expect ?

motor not powerd by arduino, but driver is trigerd by arduino (arduino is only running the motor in desired direction) ,and tht not a problm ,u not understnding my problm,

arduino runs motor thr motor driver ,and motor rotats pot,and pot output is connect to analog pin of arduino...

my problm is,

i have variable val=100(manually asumed,),
arduino knows the pot reading,

i want program that rotats motor till val match to pot reading,,

while (analogRead(potPin) < val)
{
  //run motor forward
  //wait a short time
  //stop the motor
}

I hate to be that guy especially since I'm a noob but in the future please watch your spelling errors because it makes it hard to read.

With that being said, are you still having problems?

I would like to help you if I can.

I hate to be that guy especial since I'm a noob (did you forget the comma ?) but in the future please use proper grammar and watch your spelling errors because it makes it hard to read.

Mr Pot, meet Mr Kettle

Oh my goodness, you're right.
I'm just trying to be polite and helpful.

Sorry