I want pushbutton to stop signalling DC motor to run

Hello

I wanted to get some advice on my project.

So right now I have a pushbutton and one DC motor connected to adafruit motor shield V2 and when the pushbutton is down the motor runs just fine.

What I want to do is for the motor to stop run after about 1 or 2 seconds even though the pusbutton is down.
I can't find any examples anywhere on how I can make this work so I was hoping to get some answers here.

Here is the code I already have.

/* 
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control

For use with the Adafruit Motor Shield v2 
---->	http://www.adafruit.com/products/1438
*/

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); 

// Select which 'port' M1, M2, M3 or M4. In this case, M1
Adafruit_DCMotor *myMotor = AFMS.getMotor(1);

// You can also make another motor on port M2
//Adafruit_DCMotor *myOtherMotor = AFMS.getMotor(2);

// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 4;


void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Adafruit Motorshield v2 - DC Motor test!");

  // make the pushbutton's pin an input:
  pinMode(pushButton, INPUT);

  AFMS.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz
  
  // Set the speed to start, from 0 (off) to 255 (max speed)
  myMotor->setSpeed(150);
  myMotor->run(FORWARD);
  // turn on motor
  myMotor->run(RELEASE);

  
}

void loop() {
  uint8_t i;


    // read the input pin:
  int buttonState = digitalRead(pushButton);
  // print out the state of the button:
  Serial.println(buttonState);
  delay(1);        // delay in between reads for stability

  if (buttonState==1){
     delay(1000);
    
  myMotor->run(FORWARD);
    myMotor->setSpeed(150);  
    delay(1000);


    
 }


 else if (buttonState==0){
  myMotor->run(FORWARD);
    myMotor->setSpeed(0);  
  
  }
  
  
}

This page may have information that you can use.