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.
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: