This doesn't work

I can't seem to get my very first motor to work. This is the first code that I wrote from scratch:

// Moter control 01
// burst the motor a few times and loop

#define MOTOR 9 // the pin for the motor

void setup() {
  pinMode(MOTOR, OUTPUT); // the pin for the motor
                         // is an output
}

void loop() {
  
  digitalWrite(MOTOR, HIGH); // turn the motor on
  delay(1000);                // waits for a second
  digitalWrite(MOTOR, LOW);  // turns the motor on
  delay(600);                // waits for some time
}

would it work if I have the circuit put together correctly? If so, what is the correct circuit, because I can't understand The diagram that's in the book.

Yeah, the code is fine.

What kind of motor is it? I'm assuming it draws >30mA, and therefore you need a transistor. Attach a power supply to the collector of the transistor, the base to pin 9 (via a 1K resistor), and the emitter to one end of the motor. Connect the other end of the motor to the power supply's ground.

Make sure you connect the power supply's ground and the Arduino's ground.

Wrong forum topic? ;)

I can't seem to get my very first motor to work.

In what way does it not work? Does the motor move all the time? Not at all? Randomly? Does anything smoke or get hot? What did you expect it to do? And how did you wire the motor to the Arduino pin? Via a transistor driver?