Brushed DC Motor Speed Control with Incremental Encoder

digitalRead() can't tell you a value changed, it can only tell you what it is now.

You don't care what it is now, you want to know if it has changed since the last time you looked.

int previous ;

void loop ()
{
  int current = digitalRead (pin) ;
  if (current != previous)
  {
    if (current)
    {
      // just changed to HIGH / true
    }
    else
    {
      // just changed to LOW / false
    }
  }
  previous = current ;
}