control 2 Dc motor separately with 2 pots

Hi all im new to arduino and i've been experimenting a lot and found arduino so cool. im having a project right now but it seems i can't get it right. I want to control(Speed) 2 dc motor separately using 2 pots. The problem is when i use the one pot to control 1 motor both of them speeds up. i dont know what's wrong. here's the code im experimenting. thanks a lot.

int potPin1 = 1;  
int potPin2 = 4;
int transistorPin1 = 9;   
int transistorPin2 = 11;  
int potValue1 = 0;  
int potValue2 = 0;
void setup() {                         
  pinMode(transistorPin1, OUTPUT);
  pinMode(transistorPin2, OUTPUT);
}
void loop() {                           
  potValue1 = analogRead(potPin1) / 4;  
  analogWrite(9, potValue1);
  
  potValue2 = analogRead(potPin2) / 4;  
  analogWrite(11, potValue2);
}

The example is in this website ( http://homepage.mac.com/joester5/art/digitalart2/dcmotor.html ) i followed it and got it working but when i add another dc motor and pot it works but problem is both of them speeds up when i rotate 1 pot. Hope someone can help me

OK with my physic hat on I would say that you haven not wired the second pot’s wiper to analogue input 4 like your software is expecting.

Thanks for the reply..

I did but still both of them is spinning which i don't want to happen when i rotate 1 pot. I have pot1 for dcmotor1 and pot2 for dcmotor2.

when i rotate pot1 both of them spins up and when i rotate pot2 still both of them spins up. what am i doing wrong please help me.

The motor will only stop spinning when it's pot is fully at one end. It is not clear from your words what is exactly happening. However I suspect you have wired it up incorrectly. Do some debugging. Remove the line that drives motor 1. Now will pot 2 still affect motor 1, if so you have defiantly got something wrong with the transistor wiring.

when i rotate pot1 both of them spins up and when i rotate pot2 still both of them spins up.

Add a call to Serial.begin() to setup(). Add some Serial.print() and Serial.println() statements to loop, to print the values, with description, read from the two analog pins. If the values are different, but the motors still change speed together, the problem is not with the Arduino or it's code. If turning one potentiometer changes both readings, then the problem is with how the potentiometers are wired to the Arduino.