[solved]mcp23018 not working
i forgot dip package counter clock wise , plugged stuff on 15+ pins on wrong end works now.
you can delete thread if want.
i bought mcp23018 because wanted more i/o ports on uno wired open drain circuit yellow led supposed on both of them on when set portb 0 both of them still on , can not understand why using mcp23018 library:
https://github.com/maniacbug/arduino/tree/master/libraries/mcp23018
and here code have attached picture of breadboard , here datasheet http://ww1.microchip.com/downloads/en/devicedoc/22103a.pdf
you can delete thread if want.
i bought mcp23018 because wanted more i/o ports on uno wired open drain circuit yellow led supposed on both of them on when set portb 0 both of them still on , can not understand why using mcp23018 library:
https://github.com/maniacbug/arduino/tree/master/libraries/mcp23018
and here code have attached picture of breadboard , here 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()
{
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);*/
}
to start
#define bit0 0
should
#define bit0 1
as current led 0 think no led set ...
#define bit0 0
should
#define bit0 1
as current led 0 think no led set ...
Arduino Forum > Using Arduino > LEDs and Multiplexing > [solved]mcp23018 not working
arduino
Comments
Post a Comment