Arduino ile dc motor

Merhabalar arkadaşlar. Bir konuda yardıma ihtiyacım bulunuyor.
12 volt ile çalışan dc motoru çalıştırmak için butona basıp çalıştırmam gerekiyor.
Butonu kapattığımda ise motor tam tersine yarım saniye dönüp durmasını istiyorum.
Pot ise motor hızını ayarlamak için. Kodda hata yapıyorum tinkercad ta çalışmadı.
Motoru sürmek için L293B kullanablirmiyim?Kod ise aşağıda.

int pot = A0;
int potdeger = 0;
int motor1 = 5;
int motor2 = 6;
int buton = 2;
int motorhiz = 3;
int motorhizdeger = 0;

void setup()
{
pinMode(pot,INPUT);
pinMode(motor1, OUTPUT);
pinMode(motor2, OUTPUT);
pinMode(buton, INPUT);
pinMode(motorhiz, OUTPUT);
}

void loop()
{
int butondurum = digitalRead(buton);
int potdurum = analogRead(pot);
int motorhizdeger = map(potdurum, 0, 1023, 0, 255);
analogWrite(motor1, LOW);
analogWrite(motor2, LOW);
if (butondurum == HIGH)
{
while (true)
{
analogWrite(motor1, motorhizdeger);
analogWrite(motor2, LOW);
butondurum = digitalRead(buton);
if (butondurum == LOW)
{
break;
}
}
analogWrite(motor1, LOW);
analogWrite(motor2, motorhizdeger);
delay(500);
analogWrite(motor1, LOW);
analogWrite(motor2, LOW);

}
else
{
analogWrite(motor1, LOW);
analogWrite(motor2, LOW);
}
}