DC Motor and Potentiometer positioning

u help a little now i need to write this code but basic it should look like this arduino read a value from serial.read and then motor turn left or right till my value is true

then motor turn left or right till my value is true

You need to be specific here. Which value? What makes the value "true"? (In C, anything that is not zero is "true" - but you mean something else here, I think)

In fact, the more specific and very clear you are, the easier it is to write the program. In fact that is how you write a program. You start of with a vauge idea. Then write a few sentences describing it in more detail. Then change each of those sentences into several with more excruciating detail. And again. And then suddenly you have written it in so small steps, that it is trivial to translate to C.

value its form 0 to 1023 and if the serial.read input its lets see 500 then this while by my true value if the potentiometer "say so"

That is what I suggested. But take it in small steps. First write a program that calls your motor left/right code if the analogRead() is above/below a fixed value.

Search this forum for "nnnC" - it is a small function I wrote to send decimal values and a command letter using Serial. Good for quick debugging code/prototypes.

One fairly inexpensive setup might be to take a standard servo, mechanically modify it for continous rotation, remove the internal pot and externally connect the 10 turn pot. Connect the pot to the gizmo being rotated and use the servo to rotate the gizmo. The below shows the general idea.

http://www.servocity.com/html/belt_drive_pan_systems.html

om trying to write some code but it dont work have no clue

void Motor()
{
	val1=targetval1;
	val2=targetval2;
	if (targetval1!=targetval2)
	{
		Motor_ON();
		{
			if (targetval1<targetval2)
			{
				Motor_1_3();
			}
			if (targetval1>targetval2)
			{
				Motor_2_4();
			}
		}
	}
	if (targetval1=targetval2)
	{
		Motor_OFF();
	}
}

im using now 2 potentiometer one its mechanically paired with dc motor and the other its for putting my values

Have you looked at the "knob" servo example in the arduino IDE?

yes im trying to "modifying" this code for my purpose

The below code is for servos and different from your motor setup, but it includes a deadband setup that may eliminate position hunting by the motors. In your code you should add printing the generated values and such to the serial monitor so you can see if you are getting what you expect.

//zoomkat dual pot/servo test 12-29-12

#include <Servo.h> 
Servo myservo1;
Servo myservo2;

int potpin1 = 0;  //my pot pin
int potpin2 = 1;

int newval1, oldval1;
int newval2, oldval2;

void setup() 
{
  Serial.begin(9600);  
  myservo1.attach(2);  
  myservo2.attach(3);
  Serial.println("testing dual pot servo");  
}

void loop() 
{ 
  newval1 = analogRead(potpin1);           
  newval1 = map(newval1, 0, 1023, 0, 179); 
  if (newval1 < (oldval1-2) || newval1 > (oldval1+2)){  
    myservo1.write(newval1);
    Serial.print("1- ");
    Serial.println(newval1);
    oldval1=newval1;
  }

  newval2 = analogRead(potpin2);
  newval2 = map(newval2, 0, 1023, 0, 179);
  if (newval2 < (oldval2-2) || newval2 > (oldval2+2)){  
    myservo2.write(newval2);
    Serial.print("2- ");    
    Serial.println(newval2);
    oldval2=newval2;
  }
  delay(50);
}

dude ur amazing i just looking for the deadband code

void Motor()
{
	val1=analogRead(Poti1);
	val2=analogRead(Poti2);
	if ((val1>val2)&&(val1>minval))
	{
		Motor_1_3();
	}
	if ((val1<val2)&&(val1<maxval))
	{
		Motor_2_4();
	}
	if ((val1=val2)||(val1=minval)||(val1=maxval))
	{
		Motor_OFF();
	}
}

one question can i put val = analogread to a different void or this wouldn't work

one question can i put val = analogread to a different void or this wouldn't work

What happened when you tried it?

nothing my values wear 0 on both potentiometers
now have issue withe the deadband when i use

if (val1 < (targetval1-10) | val1 > (targetval1+10){
if ((val1>val2)&&(val1>minval))
	{
		Motor_1_3();
                         targetval1=val1
	}

my code works one whey

There's a difference between bit wise OR | and (no pun intended) logical OR ||

still no use the same problem

Still no code

here is the code

void Motor()
{
	val1=analogRead(Poti1);
	val2=analogRead(Poti2);
	targetval1=(val1<(val1-10)||val1>(val1+10));
	if ((val1>val2)&&(val1>minval))
	{
		Motor_1_3();
	}
	if ((val1<val2)&&(val1<maxval))
	{
		Motor_2_4();
	}
	if ((targetval1=val2)||(val1=minval)||(val1=maxval))
	{
		Motor_OFF();
	}
}

The below might need some attention, depending on just what you are trying to accomplish.

if ((targetval1=val2)||(val1=minval)||(val1=maxval))

my minval is 10 and my maxval 1000 thats because i don't want damage the potentiometer so im using this as a stop point
it seems to me as hes in loop with this part

             if ((val1>val2)&&(val1>minval))
	{
		Motor_1_3();
	}
	if ((val1<val2)&&(val1<maxval))
	{
		Motor_2_4();
	}

Something that may/may not make a difference depending on what you are trying to do.

http://arduino.cc/en/Reference/If