How are the buttons wired? Do You use pull up or pull down resistors?
if (digitalRead(CCW))
digitalWrite(DIR, HIGH);
else if (digitalRead(CW))
digitalWrite(DIR, LOW);
else
I suggest dropping that last else. Else CW rotation will not work.