mega pins not working?

i have a small dc motor that i m trying to test on my mega sketch but ive tried a few differant pins and nothing happens but if i hook it to 5v and grnd on the mega it works ive even tried this simple sketch and nothing happens

 int motorPin1 = 3;
int motorPin2 = 4;
void setup(void)
{
  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
}

void loop(void) 
  {
    
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);
}

Unless your motor is TINY (like the size of the vibrator motor in a cellphone) you can’t draw enough current from an Arduino pin to run it. If you wan the control the speed (but not direction) you can use an NPN transistor between the motor and Ground to act as a switch. Collector pin goes to motor. Emitter pin goes to Ground. Base pin goes to Arduino pin through a resistor (270 Ohms is good).

so do the pins not acually put out 5v when set to high?

They put out close to 5V at an Absolute Maximum current of 40 mA. They don't really have to put out 5V as long as they put out a high enough voltage to be recognized as HIGH by an input pin.

The starter motor in a car runs on 12V but you can't just string together eight AAA cells and expect them to start the car.