Go Down

Topic: [solved]mcp23018 not working (Read 1 time) previous topic - next topic


Apr 29, 2012, 08:01 pm Last Edit: Apr 30, 2012, 03:09 am by Mr_arduino Reason: 1
I forgot that dip package is counter clock wise and plugged some stuff on the 15+ pins on the wrong end it works now.
You can delete this thread if you want.
I bought the mcp23018 because I wanted more i/o ports on my uno so I wired it up to get an open drain circuit only the yellow led is supposed to be on however both of them are on even when I set portb to zero both of them are still on and I can not understand why I am using the mcp23018 library:
and here is my code Also I have attached a picture of my breadboard and here is the datasheet http://ww1.microchip.com/downloads/en/DeviceDoc/22103a.pdf
Code: [Select]

#include <mcp23018.h>

#include <Wire.h>
MCP23018 pex(0);
//led i/o expander

#define bit0 0
#define bit1 2
#define bit2 4
#define bit3 8
#define bit4 16
#define bit5 32
#define bit6 64
#define bit7 128
unsigned char current_led;
unsigned char bit_array[]={bit0,bit1,bit2,bit3,bit4,bit5,bit6,bit7};

void setup()
      // pex.SetPullups(0,2);
void loop()
 // pex.SetPortB(1);
 /*if (current_led==8)



to start

#define bit0 0

should be

#define bit0 1

as current led is 0 I think no led is set ...
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


The second line of the datasheet says "I/O pins default to input".  Do you need to set your output pins as outputs?

The outputs are Open Drain which means they switch between DISCONNECTED and GROUND.  Do you have the LED connected between +5 and the output (with an appropriate current limiting resistor in series)?
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


The libary that I am using sets them all to output when I call begin()
Code: [Select]

void MCP23018::begin(void)
// Set all pins to outputs
Serial.println("started mcp23018");

johnwasser you mean something like this
Code: [Select]

gnd   5v
|     |
|     |
|      R (220}
led-  led+
Vss   gpio

That is what I did and they are still all on.

Go Up