MCP23008 Help

How do I control LEDs using an MCP23008?

I have tried Searching but they all seem to refer to LCD Displays.

I want to turn all Outputs on & off!

http://files.jeelabs.org/2009/11/DSC_0756.jpg

Thanks in advance

There are two types of this chip the MCP23008 and the MCP23S08, I can’t tell which you have.
If it is the MCP23008 then this is the I2C version and is quite easy to drive. Look at the data sheet and see the internal registers. You have to set up the data direction register to be outputs and then write to the output register.
I used the larger MCP23016 in this project:-
http://www.thebox.myzen.co.uk/Hardware/Pendulum.html
This is the same chip only with an A and a B side. That project just uses them for turning on LEDs. Down load the code and take a look what I did.

#include <Wire.h>

void setup() {
    Wire.begin();                      // initialise the wire library and hardware

    Wire.beginTransmission(0x26);      // start talking to the device
    Wire.send(0x00);                   // select the IODIR register
    Wire.send(0xff);                   // set register value-all high, sets all pins as outputs on MCP23008
    Wire.endTransmission();            // stop talking to the devicevice
}
 

void loop() {
    Wire.beginTransmission(0x26);      // start talking to the device
    Wire.send(0x09);                   // select the GPIO register
    Wire.send(0xff);                   // set register value-all high
    Wire.endTransmission();            // stop talking to the device

    delay(500);                        // wait for 1/2 a second

    Wire.begin();                      // initialise the wire library and hardware

    Wire.beginTransmission(0x26);      // start talking to the device
    Wire.send(0x09);                   // select the GPIO register
    Wire.send(0x00);                   // set register value-all low
    Wire.endTransmission();            // stop talking to the device

    delay(500);                        // wait for 1/2 a second
}

Any clues? Does this work or not work? What is it supposed to do? What happens?

From looking at it you need to set up the data direction register in setup and remove the wire begin from the loop.