Snippet Tag: Arduino MCP23008

MCP23008 arduino code

#include #include MCP23008 mcp; void setup(void) { Serial.begin(9600); mcp.begin(); // The address can be changed making the option of connecting multiple devices mcp.getAddr_MCP23008(MCP23008_DEFAULT_ADDRESS); // 0x20 // mcp.getAddr_MCP23008(MCP23008_ADDRESS_A2A1A0_001); // 0x21 // mcp.getAddr_MCP23008(MCP23008_ADDRESS_A2A1A0_010); // 0x22 // mcp.getAddr_MCP23008(MCP23008_ADDRESS_A2A1A0_011); // 0x23 // mcp.getAddr_MCP23008(MCP23008_ADDRESS_A2A1A0_100); // 0x24 // mcp.getAddr_MCP23008(MCP23008_ADDRESS_A2A1A0_101); // 0x25 // mcp.getAddr_MCP23008(MCP23008_ADDRESS_A2A1A0_110); // 0x26 // mcp.getAddr_MCP23008(MCP23008_ADDRESS_A2A1A0_111); // 0x27 // The I/O Pin Direction and Mode of the Corresponding Pin // can be changed via the following function mcp.pinMode(4, OUTPUT); // Pin 0 and Output Mode } void loop(void) { byte error; int8_t address; address = mcp.mcp_i2cAddress; // The i2c_scanner uses the return value of //

Read More »