My i2c MCP23017 i/o expander is not working

As a christmas present I bought myself some MCP23017's (among other things) but I can't get it working. I am new to i2c in general; so i am probably making a simple mistake. I have been following this tutorial over at tronixstuff

Here is a picture of my wiring; since this picture was taken I've added two pull up resistors (2.2o) from both SDA and SCL to the reset pin which is tied to 5v. As well I have ensured that the LED works.

As well, this is the code which I am running on my Teensy2:

#include <Wire.h>

void setup(){
  Wire.begin();
  delay(100);
  Wire.beginTransmission(0x20);
  Wire.write(0x00);
  Wire.write(0x00);
  Wire.endTransmission();
  delay(100);
  Wire.beginTransmission(0x20);
  Wire.write(0x12);
  Wire.write(11111111);
  Wire.endTransmission();
}

void loop(){
    
}

So any idea's? I'm pretty stuck here. Thanks!

Michael

hey there,
try changing line Wire.write(11111111); to Wire.write(B11111111); or Wire.write(255); or Wire.write(0xff); i not a pro yet, but i think when u send binary you have to tell it somehow its birary. when i ve played with i2c stuff the most common problem is having the address wrong 0x20 looks right but u can try 0x40 too.
i dont know if that helps,
red

Hi Centizen,

I recently had a similar project. Check out this post: http://christophhartel.com/arduino-io-expander-with-mcp23017-and-74hc4051/
At the bottom of the page I have included the code I wrote to drive two MCP23017 and two analog multiplexers with an Arduino Uno.
The Adafruit library for the MCP23017 makes programming really easy.

I hope this help.

Christoph