Motorized pinwheel <starter kit>

Hi
I'am trying to make the motorized pinwheel starter kit project

i used the sample code
the motor is running (i think slowly) if i press the button or not
what i had did wrong ?
PS: the images are high quality you could copy the image link and paste it in a new tab

  1. Post your code, using code tags, or a link to the pinwheel code.
  2. Post a schematic of your circuit. A photo of a hand drawn diagram will do.
    Without both of those, we have no idea what you're doing wrong (or right).
/*
  Arduino Starter Kit example
 Project 9  - Motorized Pinwheel
 
 This sketch is written to accompany Project 9 in the
 Arduino Starter Kit
 
 Parts required:
 10 kilohm resistor
 pushbutton
 motor
 9V battery
 IRF520 MOSFET
 1N4007 diode
 
 Created 13 September 2012
 by Scott Fitzgerald
 
 http://arduino.cc/starterKit
 
 This example code is part of the public domain 
 */

// named constants for the switch and motor pins
const int switchPin = 2; // the number of the switch pin
const int motorPin =  9; // the number of the motor pin

int switchState = 0;  // variable for reading the switch's status

void setup() {
  // initialize the motor pin as an output:
  pinMode(motorPin, OUTPUT);      
  // initialize the switch pin as an input:
  pinMode(switchPin, INPUT);     
}

void loop(){
  // read the state of the switch value:
  switchState = digitalRead(switchPin);

  // check if the switch is pressed.
  if (switchState == HIGH) {     
    // turn motor on:    
    digitalWrite(motorPin, HIGH);  
  } 
  else {
    // turn motor off:
    digitalWrite(motorPin, LOW); 
  }
}

here is the code i'm working of the digram..

Did you connect the motor to the battery +?

no , i'am powering the board (which is connected to the motor) with 9 dc volt from a power supply

Then connect the motor to that power supply, not to the Arduino Vcc.

i found the problem it was with the power supply (reversed cathode , anode)