[SOLVED]Arduino and three mcp23017s problem.

I'm not native english speaker, so forgive me my bads.

Ok. Here's the deal.

In my arduino uno I need more outputs and inputs. I bought 3 MCP23017s. One of them for receive states from 8 microswitches and other to control 32 LEDs. LED states depends on which microswitch is actually pushed(only one of them could be pushed in time). For example: When I push button on B block(0x20 mcp23017s) in 0 pin, all I want to do is send 10101010 to 0x21s block A. And it's working for only one button. When I connect second button I want to send 10101010 to 0x21s block B. And there's problem. It doesn't work. For one button everything is ok, but for more than one it's not. No matter if I push first or second button it always send 10101010 to 0x21s A block. It send 10101010 to 0x21s B block only, when I push 2 buttons at the same time, but it send bytes to A block too...

Hardware is ok, because I checked it for one button and everything was working well, so problem must be hidden in software.

I know that you could don't get what I mean, so here is code:


I need this in my project which is very important for me, so please help me. Thank you!