Solved - ***Newbie**** Need help with simple project

I am trying to control a simple DC motor with a potentiometer. I have pulled from a couple of online places on how to wire and do the sketch. I have setup to see through the serial window that the potentiometer is sending signal for the motor. The motor will not come on. I have verified the motor will work, I have used a volt meter and tell I am getting voltage, but it will not come alive. Attached is a picture of my setup and below is my code. Any help for this newbie will be appreciated.

int potPin = A0; // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the motor
int potValue = 0; // variable to store the value coming from the pot
int motorValue = 0; // varialbe to set the value for the motor

void setup() {
pinMode(motorPin, OUTPUT);
pinMode (potPin, INPUT);
Serial.begin(9600);
}

void loop() {
potValue = analogRead(potPin);
motorValue = map(potValue, 0, 1023, 0, 255);
analogWrite(motorPin, motorValue);
Serial.print ("potentiometer = " );
Serial.print (potValue);
Serial.print ("\t motor = " );
Serial.println(motorValue);
delay(2);

}

I can't see from the photo what is driving the motor.

Please use code tags when posting code.

You can't drive a motor directly from an Arduino pin - it can't produce enough current - only 40mA - and you are likely to damage the Arduino.

Can you show us a diagram of how you have things connected.

...R

AWOL - I will learn up posting with code tags, thank you.

Rboin2 - Attached are my schematics.

You cannot drive a motor directly from an Arduino's output pin.
Have a look in the Playground for ways of buffering the output.

You may already have damaged your Arduino.

The schematic shows a transistor between Arduino pin 9 and the motor, so the pin is probably OK. However, it also shows the motor powered from the 5V rail of the Arduino which is almost certainly not OK.

After having a day away from it, I figured out what was wrong. I should of been running the (-) to the Transistor. Below is my corrected schematics that is working. The potentiometer controls the motor as I was looking for. I did change one thing in the code.

motorValue = map(potValue, 0, 1023, 0, 255);
to
motorValue = map(potValue, 0, 1023, 120, 255);

I found it to be basically as low as it would run with out turning off. It was just to see what it does by changing the min/max.