Controlling speed via pot & direction via button

Have been googling furiously for the last few hours and have come to a dead end. I'm trying to modify some code from the Sunfounder Super Kit to control the speed of a motor via a potentiometer and the direction of the motor from the press of a button. I have achieved directionality of the motor via button press, but haven't been able to suss out the problem with my code for the speed via potentiometer input. Currently upon pressing the button the motor will start up in a given direction at whatever speed the potentiometer indicates at the moment the button is pressed. However, the speed cannot be adjusted after the button has been pressed; it remains static until such time as the button is pressed again.

This is my loop:

void loop()
{
  inputValue = analogRead(analogPin);  //read the value from the sensor
  outputValue = map(inputValue,0,1023,0,255);  //Convert from 0-1023 proportional to the number of a number of from 0 to 255
  int keyRead = digitalRead(keyPin);  //read and store current key state
  if (keyRead != keyState)
  {
    if (keyState == LOW)
    {
      motorMode = !motorMode;  //reverse direction
      if (motorMode)
      {
       clockwise(200);
       delay(1000);
      }
      else
      {
       counterclockwise(200);
       delay(1000);
      }
    }
  }
  keyState = keyRead;  //store the key state as current state
}

I can post the rest of my code if further analysis is needed, but I'm pretty sure the issue is in there somewhere. Please let me know where I've gone terribly wrong.

, but I'm pretty sure the issue is in there somewhere.

Really?
Where do you write the value from the potentiometer?

It's within the clockwise/counterclockwise definitions. I didn't even think that the issue might be there, as my problem was with the process not being done continually (in my mind, this means "the loop,") but I am the dictionary definition of beginner, so that's probably a fallacy. Those definitions are as below:

//The function to drive motor rotate clockwise
void clockwise(int Speed)
{
  Speed = outputValue;  //set Speed to value from sensor
  analogWrite(motorIn1,Speed);  //set the speed of motor
  analogWrite(motorIn2,0);  //stop the motorIn2 pin of motor
}
//The function to drive motor rotate counterclockwise
void counterclockwise(int Speed)
{
  Speed = outputValue;  //set Speed to value from sensor
  analogWrite(motorIn1,0);  //stop the motorIn1 pin of motor
  analogWrite(motorIn2,Speed);  //set the speed of motor
}

You need to read the pot and use its value to set the speed of the motor regardless of the state of the button.

So the read and write from pot to motor needs to take place in the loop. I'll rewrite the sketch and see if I can make it work. I'll post the results upon completion. Thanks!

I've placed the read from pot and write to speed inside the loop and have alleviated the issue with the potentiometer, however I have now created a situation in which the button press does not cause the motor to reverse directions. The entirety of my sketch is below:

/***************************************/
const int motorIn1 = 9;  //attach to one of the pin of the motor
const int motorIn2 = 10;  //attach to another pin of the motor
const int keyPin = 12;  //the number of the key pin
const int analogPin = A0;  //the analog input pin attach to

int movingMotor = motorIn1;  //either motorIn1 or motorIn2
int stillMotor = motorIn2;  //opposite of above
int keyState;  //variable to store the key state
int inputValue = 0;  //variable to store the value coming from sensor
int outputValue = 0;  //variable to store the output value
int motorMode = 1;  //motor is rotating clockwise (1) or counterclockwise (0)
/***************************************/
void setup()
{
  pinMode(motorIn1,OUTPUT);  //initialize the motorIn1 pin as output
  pinMode(motorIn2,OUTPUT);  //initialize the motorIn2 pin as output
  pinMode(keyPin,INPUT_PULLUP);  //initialize the key pin as input
  keyState = digitalRead(keyPin);  //read the initial state
}
/****************************************/
void loop()
{
  inputValue = analogRead(analogPin);  //read the value from the sensor
  outputValue = map(inputValue,0,1023,0,255);  //Convert from 0-1023 proportional to the number of a number of from 0 to 255
  int keyRead = digitalRead(keyPin);  //read and store current key state
  if (keyRead != keyState)
  {
    if (keyState == LOW)
    {
      motorMode = !motorMode;  //reverse direction
      if (motorMode)
      {
       movingMotor = motorIn2;
       stillMotor = motorIn1;
      }
      else
      {
       movingMotor = motorIn1;
       stillMotor = motorIn2;
      }
    }
  }
  analogWrite(movingMotor,outputValue);  //set the speed of motor
  analogWrite(stillMotor,0);  //stop the other pin of motor
  delay(1000);
  keyState = keyRead;  //store the key state as current state
}
/****************************************/

Any help in figuring out why the button press does not cause the desired change in motor direction in the sketch above would be very much appreciated.

(deleted)

Thank you for the suggestion! In the end, I suppose the original tutorial I was following assumed I'd need to thoroughly debounce the button, giving me a delay time of one second! I changed this to 50 milliseconds and am having a much better time with the reverse button.

Thanks to all for your help!