mcp4131 and attiny85

PaulS:

int  command_data;

digitalWrite (CS, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, highByte (command_data) );
shiftOut(dataPin, clockPin, MSBFIRST, lowByte (command_data) );



command_data, being a local variable, is not initialized by the compiler, and is never explicitly valued. So, why do you want to send garbage to the mcp4131?

Its not necessary in this patch anyway, replacing it with val works fine.

EDIT:: I got it working!! crazy i spent so long to get an analog pot to fade an LED...

Here it is if anyone wants it

byte CS = 1;
byte dataPin  = 2;
byte clockPin  = 0;
byte analogPin  = 3;

int val = 0;

void setup() {

pinMode(CS, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(analogPin, INPUT);




}

void loop() { 
 // command_data = whatever it's being changed to
 
val = analogRead(analogPin);



val = map(val, 0,1024, 0,256);


digitalWrite (CS, LOW);
shiftOut (dataPin, clockPin, MSBFIRST, highByte (val) );
shiftOut (dataPin, clockPin, MSBFIRST, lowByte (val) );
digitalWrite (CS, HIGH);

delay(4);

}