Ok to my question. I am trying my hand at running a digital potentiometer(Specifically a MCP4231). I would like to use it as a variable voltage divider to mimic/replace a joystick from an electric wheel chair. So I've read through the datasheet and while I'm pretty sure that I understand how to connect it, I'm not sure that I have the SPI object initialized correctly, or if I do have it initialized correctly, if i am sending the correct commands. Any light shed will be greatly appreciated. Thanks!
Here is my code. Almost verbatim from the wiki.
public static void Main() { SPI.Configuration Device1 = new SPI.Configuration( Pins.GPIO_PIN_D10, // SS-pin true, // SS-pin active state 0, // The setup time for the SS port 0, // The hold time for the SS port false, // The idle state of the clock true, // The sampling clock edge 1000, // The SPI clock rate in KHz SPI_Devices.SPI1 // The used SPI bus (refers to a MOSI MISO and SCLK pinset) ); SPI SPIBus = new SPI(Device1); while (true) { // Writes a single byte with value 255 to the SPI device byte[] WriteBuffer = new byte[2]; WriteBuffer[0] = 0; WriteBuffer[1] = 0; SPIBus.Write(WriteBuffer); Thread.Sleep(1000); WriteBuffer[0] = 0; WriteBuffer[1] = 120; SPIBus.Write(WriteBuffer); Thread.Sleep(1000); } }