How to control a DC Motor

The playground and youtube haven't been very helpful on this, so I thought it was time to ask it on the forums. I have about a week's experience with arduino and I'm trying to control a DC motor, but it's not working. I don't care about the direction, I'm trying to keep it as simple as possible. I've attached my schematic, is anything wrong with it? When I print out the analog readings from Pin 9, I don't get the values I expect. It always starts off
high, around 900, then drops to around 220 and only move between 210 and 220. So either my schematic is wrong or I've wired it wrong. Here's my code:

int motorPin = 9;

void setup() {
  Serial.begin(9600);
}
    
void loop() {
  // Accelerate motor from 0 to 255
  for (int i = 0; i <= 255; i++) {
    analogWrite(motorPin, i);
    delay(10);
    Serial.println(analogRead(motorPin));
  }
  
  delay(1000);
  
  for (int i = 255; i >= 0; i--) {
    analogWrite(motorPin, i);
    delay(10);
    Serial.println(analogRead(motorPin));
  }
  
  delay(1000);
}

The analogue output pin is not an analogue input pin.
You can't read motorPin as an analogue input and expect sensible results.
Truth to tell, it isn't even an analogue pin at all, just PWM.

Ok, so I guess I can't use that for debugging. How does the schematic look?

I don't get the "debugging" - you've just written a PWM value to the pins register, so why do you think that value can change between writing and printing?

I can't see your schematic on my phone.

Well the motor wasn't turning, and I wanted to make sure I wasn't doing anything stupid. I guess that's not where the problem is.

No problem, just let me know if you get a chance.

Depending on what motor you have, that 9V battery likely isn't going to power it for long. Does the motor run when you connect it directly to the battery?

You need a resistor on the base of the transistor. Without knowing what transistor you have, I'd try something between 220 and 1K.