Pages: [1]   Go Down
Author Topic: My i2c MCP23017 i/o expander is not working  (Read 1018 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Code:
#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
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Kalamazoo Michigan
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Pages: [1]   Go Up
Jump to: