You've not told us how your MCP23016 is connected.

Do a SEARCH on MCP23016 on this forum - there are code examples.