limchengwei
Published © CC BY

8 MCP23017 Small Chip PCB

Thank you JLCPCB for sponsoring this project. Please order your PCB at jlcpcb.com/RAT

IntermediateFull instructions provided3 hours318
8 MCP23017 Small Chip PCB

Things used in this project

Hardware components

JLCPCB Customized PCB
JLCPCB Customized PCB
×1
MCP23017 Small Chip
×8
Male Header 80 Position 2 Row (0.1")
Male Header 80 Position 2 Row (0.1")
×10
Female Header 2 Row 20 Pin (2.54mm)
×8
Female Header 1 Row 10 Pin (2.54mm)
×8

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

MCP23017 Small Chip Schematic PDF

MCP23017 Small Chip Schematic

MCP23017 Small Chip PCB

MCP23017 Small Chip Gerber

MCP23017_128_LEDs_blink

Use Arduino IDE

Code

MCP23017_128_LEDs_blink.ino

Arduino
#include <Adafruit_MCP23X17.h>

unsigned long current_time, previous_time = 0;
int i, j, state = 0;

Adafruit_MCP23X17 mcp[8];

void setup()
{
  for (j=0; j<8; j++)
  {
    mcp[j].begin_I2C(0x20+j);
    for (i=0; i<16; i++)
    {
      mcp[j].pinMode(i, OUTPUT);
    }
  }
}

void loop()
{
  for (j=0; j<8; j++)
  {
    for (i=0; i<16; i++)
    {
      state = 0;
      while (state != 2)
      {
        current_time = millis();
        if (current_time - previous_time >= 50)
        {
          previous_time = current_time;
          if (state == 0)
          {
            state = 1;
            mcp[j].digitalWrite (i, state);
          }
          else if (state == 1)
          {
            state = 0;
            mcp[j].digitalWrite (i, state);
            state = 2;
          }
        }
      }
    }
  }
}
//correct

Credits

limchengwei
24 projects • 4 followers
Contact

Comments

Please log in or sign up to comment.