Hi everyone...
i'm trying to make a mcp42010 digipot (http://www.datasheet4u.net/download.php?id=440013) work using a SPI protocol, but nothing works.
i'm using an arduino nano, i have tried using a very slightly modified version of the example digipot sketch, and i have checked the pins and the connections many times, but the digipot doesn't seem to receive any information, and just lights the led very dimly.
i have tried swapping the IC but nothing changes.
the program i'm using
// inslude the SPI library:
#include <SPI.h>
// set pin 10 as the slave select for the digital pot:
const int slaveSelectPin = 10;
void setup() {
// set the slaveSelectPin as an output:
pinMode (slaveSelectPin, OUTPUT);
// initialize SPI:
SPI.begin();
}
void loop() {
// change the resistance on this channel from min to max:
for (int level = 0; level < 255; level++) {
digitalPotWrite(1, level);
delay(1);
}
// wait a second at the top:
// change the resistance on this channel from max to min:
for (int level = 0; level < 255; level++) {
digitalPotWrite(1, 255 - level);
delay(1);
}
}
int digitalPotWrite(int address, int value) {
// take the SS pin low to select the chip:
digitalWrite(slaveSelectPin,LOW);
// send in the address and value via SPI:
SPI.transfer(address);
SPI.transfer(value);
// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin,HIGH);
}
i also tried messing around with the SPI.begin(); settings but i have achieved nothing.
i'm obviously missing something... any suggestions on what?
also, an image with the digipot connections to the nano