I have one of your MCP23017 i2c expansion boards and am attempting to use it with an HX711 loadcell board. This board requires very fast reads and writes and I believe it's not working with the MCP23017 because of how slow the mcp.digitalRead and mcp.digitalWrite methods are. I have attached a demonstration of how much slower they are below:
Code: Select all
float j;
mcp.begin_I2C();
pinMode(3, OUTPUT);
mcp.pinMode(4,OUTPUT);
Wire.setClock(400000);
mcp.digitalWrite(4, LOW);
digitalWrite(3, LOW);
delay(5000);
j = micros();
mcp.digitalWrite(4, HIGH);
j = micros() - j;
Serial.print("TOTAL TIME1: ");
Serial.println(j);
j = micros();
digitalWrite(3, HIGH);
j = micros() - j;
Serial.print("TOTAL TIME2: ");
Serial.println(j);
Code: Select all
TOTAL TIME1: 276.00
TOTAL TIME2: 8.00
Thank you!
Alex