Hello.
I am currently using an MCP41100 digipot in a circuit and I am having some trouble switch the signal pins. Currently, I have pins as so: CS - D10, SCLK - 13, and DI to 11. I want to switch it over to a smaller board which has D pins only up until D12. I tried to hook it up to that and realized it wouldn't work because of the piece of code: byte address=0x11;
. I know that in ASCII 0x11 = 17. I also know(from the oscilloscope) that the code byte address=0x11;
is what tells the arduino that my pins are on 11 and 13.(the CS pin is defined in the next line). Can anyone tell me what I need to have for so that my arduino can have SCLK on 12 and DI on 11?(I use the code from an online example).
/*
this program taken from arduino Example .
modified by By Mohannad Rawashdeh
http://www.genotronex.com
This code used to control the digital potentiometer
MCP41100 connected to arduino Board
CS >>> D10
SCLK >> D12
DI >>> D11
PA0 TO VCC
PBO TO GND
PW0 TO led with resistor 100ohm .
*/
#include <SPI.h>
byte address=0x11;
int CS= 10;
void setup()
{
pinMode (CS, OUTPUT);
SPI.begin();
// adjust high and low resistance of potentiometer
// adjust Highest Resistance .
digitalPotWrite(0x00);
delay(1000);
// adjust wiper in the Mid point .
digitalPotWrite(0x80);
delay(1000);
// adjust Lowest Resistance .
digitalPotWrite(0xFF);
delay(1000);
}
void loop()
{
for (int i = 0; i <= 255; i++)
{
digitalPotWrite(i);
delay(10);
}
delay(1000);
for (int i = 255; i >= 0; i--)
{
digitalPotWrite(i);
delay(5);
}
}
int digitalPotWrite(int value)
{
digitalWrite(CS, LOW);
SPI.transfer(address);
SPI.transfer(value);
digitalWrite(CS, HIGH);
}