Productos
I/O Expander Shield with MCP23017
Añadile mas puertos GPIO a tu Arduino con este Shield!
COD: LS101101039
Peso: 0.050 Kg
Disponibilidad: En Stock
ARS 27045.00
El producto no está disponible para la venta en este momento
Características
Product Description
I/O Expander shield is a shield used to expand the number of I/Os of an Arduino Uno. It is based on the chipset MCP23017. The chipset MCP23017 communicates with Arduino Uno through I2C interface. It adds GPIOA and GPIOB, a total of 16 I/Os. There are two LEDs and two buttons on the shield. User can decide if they want to use the built-in LED/buttons or not by using the 4-bit DIP switch.
Features:
16 bidirectional I/O ports. Default is input state.
- High-speed IIC interface (MCP23017): 100kHz, 400kHz, 1.7MHz
- Three hardware address pins allow up to eight devices on the bus
- Configurable interrupt output pin: can be configured for active-high (output), active-low (output) or open-drain (output)
- INTA and INTB can be configured to work independently or jointly
- Configurable interrupt sources: the interrupt changes according to the configured register defaults or pin level changes
- External reset input
- Low standby current: 1μA (max)
- Operating voltage:
- 1.8V to 5.5V (-40 ° C to +85 ° C)
- 2.7V to 5.5V (-40 ° C to +85 ° C)
- 4.5V to 5.5V (-40 ° C to +125 ° C)
Download:
Code
#include const byte mcp_address=0x20; // I2C Address of MCP23017 Chip const byte GPIOA=0x12; // Register Address of Port A const byte GPIOB=0x13; // Register Address of Port B const byte IODIRA=0x00; // IODIRA register const byte IODIRB=0x01; // IODIRB register void setup() { //Send settings to MCP device Wire.begin(); // join i2c bus (address optional for master) Wire.beginTransmission(mcp_address); Wire.write((byte)IODIRA); // IODIRA register Wire.write((byte)0x03); // set GPIOA-0/GPIOA-1 to inputs Wire.endTransmission(); } void loop() { Wire.beginTransmission(mcp_address); Wire.write((byte)GPIOA); // set MCP23017 memory pointer to GPIOB address Wire.endTransmission(); Wire.requestFrom(0x20, 1); // request one byte of data from MCP20317 int inputs=Wire.read(); // store the incoming byte into "inputs" if((inputs&0x01)==0) { Wire.beginTransmission(mcp_address); Wire.write(GPIOA); // address bank A Wire.write((byte)0x04); // value to send GPIOA-2 HIGH Wire.endTransmission(); } if((inputs&0x02)==0) { Wire.beginTransmission(mcp_address); Wire.write(GPIOA); // address bank A Wire.write((byte)0x08); // value to send GPIOA-3 HIGH Wire.endTransmission(); } else { Wire.beginTransmission(mcp_address); Wire.write(GPIOA); // address bank A Wire.write((byte)0x00); // value to send GPIOA LOW Wire.endTransmission(); } } [/syntaxhighlight] ==Resources== *[http://ww1.microchip.com/downloads/en/DeviceDoc/21952b.pdf Datasheet]