Multiple MCP23017 IO Expander Problem

Hi , I’m working on a project with using a MCP23017 IO Expander.
When I define a single MCP23017 everything’s work fine but I define a multiple MCP23017
I’m getting an error.

My Code ;

#include "mbed.h"
#include "MCP23017_I2C.h"
#include <stdbool.h>

void ioExpControl()
{
    bool TempError = 0;
    bool TempError1 = 0;
    //Initilization of MCP23017
    CMCP23017_I2C Expander1 = CMCP23017_I2C(p9, p10, 0x21);
    CMCP23017_I2C Expander2 = CMCP23017_I2C(p9, p10, 0x23);
    CMCP23017_I2C Expander3 = CMCP23017_I2C(p9, p10, 0x25);
    TempError = Expander1.Initialize(0,0);

    if(TempError) {
        pc.printf("Expander1_Succes=%d\r\n" );
        Expander1.write(GPB0,1);
        wait(0.01);
        Expander1.write(GPB0,0);
        wait(0.01);
        Expander2.write(GPB0,1);
        wait(0.01);
         Expander2.write(GPB0,0);
        wait(0.01);
    } else pc.printf("Expander1_Error=%d\r\n" );


int main()
{
  while(true) {
        ioExpControl();
        Led2 = !Led2;
        Thread::wait(100);
    }
}

Error ;
Screenshot 2021-12-22 162535

Error Says a Wrong params but ı did everything right didn’t I?
Anyone can help me please ?

DebugLibrary
MCP23017 Library

Hello,

You declare 3 objects in a function, then you call initialize method only for one of them. The initialize method can be important because it also call another method configure for default config of the expander.

BR, Jan

Hello Jan,
I solved the problem by changing the library, thank you for your attention.