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
#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()
{
Serial.begin(9600);
Wire.begin();
pex.begin();
// pex.SetPullups(0,2);
pex.SetPortB(1);
}
void loop()
{
// pex.SetPortB(1);
/*if (current_led==8)
{
current_led=0;
}
Serial.println(bit_array[current_led]);
pex.SetPortB(0xFF);
current_led++;
delay(500);*/
}