DC motor 2 directions 1 button

Hi guys,
i need help with a project that i struggle for a time now.Basicly i've come down to this:
i want to change dc motor rotation/direction with 1 pushbutton, on 1 push to go forward, on 1 push to go backwards. I have Arduino UNO and motor shield L298P. Could that be done with this setup?
Also a want to do a 3 stept tilt, with a potentiometer that is mounted on the DC motor, wich could help me to rotate the motor on a predefinite position when power on or off.

double post of this thread

please close that one. Thank you!

what about this code:

const int butonOpcPin = 2;
const int butonTiltPin = 4;
int butonOpcPushCounter = 0;   // counter for the number of button presses
int butonOpcState = 0;         // current state of the button
int lastbutonOpcState = 1;     // previous state of the button

void setup() {
  pinMode(2,INPUT_PULLUP);
  pinMode(4,INPUT_PULLUP);
  pinMode(12,OUTPUT);
  pinMode(9,OUTPUT);
  Serial.begin(9600);
}


void loop() {
  
  int butonOpcState = 0;
  int butonTiltState = 0;
  int butonOpcValue = digitalRead(2);  
  int butonTiltValue = digitalRead(4);
  butonOpcState = digitalRead(2);

   if (butonOpcState != lastbutonOpcState)
   {
     if (butonOpcState ==LOW) 
     {
      butonOpcPushCounter++;
      Serial.println("on");
      Serial.print("number of button pushes:  ");
      Serial.println(butonOpcPushCounter);
      }    
     else {
      Serial.println("off");
      }    
    delay(50);
    }
    lastbutonOpcState = butonOpcState;
    
for (butonOpcPushCounter=0; butonOpcPushCounter<2000; butonOpcPushCounter++)
{
if (butonOpcPushCounter % 2) 
{
  digitalWrite(12,HIGH);
  analogWrite(3,255);
  digitalWrite(9,LOW);
  delay(1600);
  digitalWrite(9,HIGH);  
  }

}

if (butonOpcPushCounter & 1 == 1)
{
  digitalWrite(12,LOW);
  analogWrite(3,255);
  digitalWrite(9,LOW);
  delay(1600);
  digitalWrite(9,HIGH);
    
} 
}