The ever-helpful Osgeld has solved more of my problems! It seems there were some discrepancies between a few datasheets and application notes about how to command individual pots, but everything is working now! Now that it's all working, I think I'll finally go ahead and get started on the library!
This will (hopefully) be the easy part, and I wouldn't be surprised if I finished up today (*knock on wood*).
After some work, I've managed to get this darned thing to fade an LED in and out!
An arduino writes values from 0-255 on Potentiometer 1 (I'm having some trouble with Pot 0, see below), and the chip then writes that value to the Pot, creating a voltage divider that fades in/out an LED! It's progress, and it's a positive sign for creating a library!
I am, however, having problems with Pot 0. For some reason, When I try sending the command bit addressing Pot 0 (B00010001), it simply doesn't work. That pot appears to be stuck on 127 (5k resistance). But, when I send the command for Pot 1 (B00010010), that pot functions fine, exactly as I expect.
Also oddly, when I send the command to write both pots (B00010011), neither work! This is very confusing.. Here's the code I'm currently using if anyone wants to give some advice:
Well, I've been in the Arduino business for a little while now, and I think it's time to stop using code people have already written and try my hand at writing a library myself. I know it's a bit of a complicated procedure, but hopefully with some practice (and a little luck), I'll be able to get a good one done.
My plan is to write a library for the MCP42X1 digital potentiometer family (but more specifically, the MCP4251 which is a 2-channel 10K potentiometer). The MCP4251 in question can be found at digikey here, and the datasheet for the MCP42X1 family can be found here.
I'll need help! Osgeld has been kindly helping me out on the Arduino forums (see here) in examining the datasheet and writing some code to work for the MCP42X1. Although a library already exists for SPI digital potentiometers, the library is ill-adapted to work with the chips I'm looking at.
I've already placed an order with Digikey for the MCP4251s (along with some other miscellaneous things I found myself running low on), and expect it to arrive today or tomorrow. I'll be sure to post something about the order when it gets here, and then follow up with progress on the library.