Go Down

Topic: I2C Set and read individual pins (Read 1 time) previous topic - next topic



I have a MCP23017 io expander that runs through i2c. It has two banks and I am able to read an entire bank or set and entire bank using a bit combination but is it possible to set individual pins on the MCP23017. For example, if I wanted to just read the state or write to the state of the 3rd pin on bank B of the MCP23017, how would I go about doing that?



how would I go about doing that?

Read the bank. Read or change the bit of interest. Write the bank.

Use bitRead and bitSet/bitWrite to read and write the individual bits.
The art of getting good answers lies in asking good questions.


Hi Alterach,

There is a Adafruit library for the MCP23017 that allows to read, write pins individually.
You can find an example, including code for an Arduino Uno at the bottom of this post:


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