This will do it:
#include <SPI.h>
// set pin 10 as the slave select for the digital pot:
const int slaveSelectPin = 10;
// Set the pot value to 2K
// value = 255 *(2K/10K)
byte value = 51;
void setup()
{
// set the slaveSelectPin as an output:
pinMode(slaveSelectPin, OUTPUT);
// initialize SPI:
SPI.begin();
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0));
// Send the value
digitalWrite(slaveSelectPin, LOW);
delay(5);
SPI.transfer(value);
delay(5);
digitalWrite(slaveSelectPin, HIGH);
}
void loop()
{
}