DigitalWrite not power enough to move 200g

I’m trying to do a small car that stops if there’s an obstacle.

const int triggerPort = 9;
const int echoPort = 10;
const int mot = 8;
 
void setup() {
 
pinMode(triggerPort, OUTPUT);
pinMode(echoPort, INPUT);
pinMode(mot, OUTPUT);
Serial.begin(9600);
Serial.print( "Sensore Ultrasuoni: ");
}
 
void loop() {

digitalWrite( mot, HIGH);
//porta bassa l'uscita del trigger
digitalWrite( triggerPort, LOW );
//invia un impulso di 10microsec su trigger
digitalWrite( triggerPort, HIGH );
delayMicroseconds( 10 );
digitalWrite( triggerPort, LOW );
 
long durata = pulseIn( echoPort, HIGH );
 
long distanza = 0.034 * durata / 2;
 
Serial.print("distanza: ");
 
//dopo 38ms è fuori dalla portata del sensore
if( durata > 38000 ){
Serial.println("Fuori portata   ");
}
else{ 
Serial.print(distanza); 
Serial.println(" cm     ");
}
 
if(distanza < 10){
 digitalWrite(mot, LOW);
}

 

delay(1000);
}

The main problem is that the motor is connected to a digitalWrite that jasn’t got power enough to move this car, so I need 5 or 3.3v, but I could’t controll it and I couldn’t stop it if I don’t connect it to a digital O.
Can you help me?

A digital pin cannot drive a motor. A digital pin can supply, safely, 20mA. Most any motor needs much more current than 20mA. If you only need the motors to turn in one direction, you can drive the motors with a logic level MOSFET that is controlled by a digital pin. If you need both forward and reverse you will need a H-bridge motor driver. We can help choose a MOSFET or driver, but we need to know the specifications of the motor (rated voltage, stall current at least).

Google "Arduino dc motor" for lots of information.

The Arduino 5V pin cannot safely power a motor either, despite some misleading web sites claims that you can.

Use a separate power supply for the motor and an appropriate motor driver. Don't forget to connect the grounds!