ESP32 Pico V3 I/O expander
Posted: Mon Jun 20, 2022 5:20 am
Hello, I am a student and I am trying to use tca6424a with a ESP32 PICO V3. When I upload the code for the interface and the code gets executed up to the test connection command after that it is not working the code I am using is attached below. I wrote the code in vscode using platformio.
The message it is showing in the serial monitor is as folows
" expander2: [ 15][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock "
Code: Untitled.cpp Select all
#include "TCA6424A.h"
#include <Arduino.h>
#define SDA 5
#define SCL 0
#define RESET_PIN 2
TwoWire twi(1);
// TCA6424A expander1(&twi);
TCA6424A expander2(&twi);
void setup()
{
Serial.begin(115200);
twi.setPins(SDA, SCL);
// expander1.begin(TCA6424A_ADDRESS_ADDR_LOW);
expander2.begin(TCA6424A_ADDRESS_ADDR_HIGH);
}
void loop()
{
// Serial.print("expander1: ");
// Serial.println(expander1.testConnection() ? "true" : "false");
Serial.print("expander2: ");
Serial.println(expander2.testConnection() ? "true" : "false");
delay(1000);
}
" expander2: [ 15][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock "