Go Down

Topic: MCP2300x behaviour (Read 1 time) previous topic - next topic


I have a MCP23009 IC that I want to use as out put. So far so good, I used it once before as input and the ..17 as output, but...

I get a strange result. The LEDs will blink, but only if I connect them anode/plus to the V+ and cathode/minus to the mcp pin

This is the source:

Code: [Select]

#include <Wire.h>
#include "MCP23009.h"

// Basic toggle test for i/o expansion. flips pin #0 of a MCP23009 i2c
// pin expander up and down. Public domain

// Connect pin #1 of the expander to Analog 5 (i2c clock)
// Connect pin #2 of the expander to Analog 4 (i2c data)
// Connect pins #3, 4 and 5 of the expander to ground (address selection)
// Connect pin #6 and 18 of the expander to 5V (power and reset disable)
// Connect pin #9 of the expander to ground (common ground)

// Output #0 is on pin 10 so connect an LED or whatever from that to ground

// Note, based on MCP23009, but I modified it a bit
// (lib was originally made for mcp23008
// that code checks for addresses < 7 and my mcp has the address pin connected to 5V (and so has address 0x27)

MCP23009 mcp;

void setup() { 
  mcp.begin(0x27);      // use default address 0

  for (int i=0; i< 8; i++)
    mcp.pinMode(i, OUTPUT);

// werkt wel, maar soms omgekeerd (dus de OUTPUT als GND?!)

// flip the pin #0 up and down

void loop() {

  for (int i=0; i< 8; i++) {
    //mcp.pinMode(i, OUTPUT);
    mcp.digitalWrite(i, HIGH);


    mcp.digitalWrite(i, LOW);


The MCP23009 outputs are open-drain.
Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store


Well, that explains a lot ;)

Thanks!!! So now I just need to rewire the signals...

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131