Connecting a small 1.5v motor to arduino

Hi im new to arduinos and im trying to use a small motor to turn on when connected to the arduino, what would the code be to use? and which ports shall i connect the wire? thanks

Use D2.

byte D2 = 2;
void setup(){
pinMode (D2, OUTPUT);
}
void loop(){
digitalWrite (D2, HIGH);
delay (1000);
digitalWrite (D2, LOW);
delay (1000);
}

Don't connect your motor directly to your Arduino

First consider that What are the specs of that motor? , I suspect that motor is a vibrating motor the kind that is found in a mobile phone!

no matter what the motor is from, you should get its datasheet to know about its power consumption and also conduct a D cell stall current calculation to get the max current the motor will take.(its basically reading the current on the multimeter while holding the motors shaft not letting it run and supply voltage!)