If I have read the datasheet correct, then you only to send the desired pot value (0-255) to the MAX5401.
so in the int digitalPotWrite(int value) routine, simply comment out SPI.transfer(address);
ie
int digitalPotWrite(int value){
digitalWrite(CS, LOW);
//SPI.transfer(address);
SPI.transfer(value);
digitalWrite(CS, HIGH);
}
Hope that helps....