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 ;
Error Says a Wrong params but ı did everything right didn’t I?
Anyone can help me please ?