A C++ object to control the Microchip MCP4261 Digital Potentiometer. For the Arduino Platform.
Mcp4261 is a simple object which allows your Arduino to control the MCP4261 digital potentiometer, to set wiper positions etc. To use, we just wire up the SPI bus and instantiate a new object. The chip powers up with the wiper state as per the value stored in its non-volatile (EEPROM) memory. This library may also work with other MCP digital potentiometer devices, and/or other AVR microcontroller devices after some tweaking. This library was tested on Arduino UNO.
Pretty much everything is explained within the example sketch file. Open Mcp4261Example.pde in Arduino IDE and upload it to your microcontroller device. Check that all of the SPI interface pins are connected OK for your device.
Download the latest version of the Mcp4261 library from GitHub. Includes example .pde file.
This library is broadly compatible with the other devices in this series. They are: Microchip MCP4131, MCP4132, MCP4231, MCP4232, MCP4141, MCP4142, MCP4241, MCP4242, MCP4151, MCP4152, MCP4251, MCP4252, MCP4161, MCP4162, MCP4261, MCP4262. Just adjust these lines in the header file as appropriate
const static bool non_volatile = true; const static unsigned int resolution = resolution_8bit;
\* Sorry, but the previous series of Microchip Digital Potentiometers (any with a total of 5 digits in their name eg 42100) had a very different command syntax and arent supported. They are listed on Page 29 of the previous MCP 4Xxxx Data Sheet.
\! Other versions of Arduino Spi library (such as `SPI.h`) wont work / wernt tested.