mcp42010 digipot SPI connection

After looking at the library referenced in my last post, I determined that most of what was in the examples was unnecessary.

The problem is the command byte. So, to raise and lower brightness on 2 LEDs consecutively, I did a nested for/next loop, with the outer level looping through the pots:

for(byte i=17; <=18; i++) {
{ inner loop incrementing "value" 50-255}
{ second inner loop decrementing "value" 255-50}
}

byte 17 is B00010001 and byte 18 is B00010010, which is what we want for MCP42010 PA0 and PA1.

As it turns out, that was the only change I needed to make from code designed for the AD5204 was to send the right values for the POTs.

Fulll code and explanation on Jeremy Blum's blog at the link in my last post in this thread.