Microsoft Windows 11 Version 22H2 (OS Build 22621.4249)
PlatformIO Core 6.1.16·Home 3.4.4 ( airm2m_core_esp32c3 board selected )
ESP32-C3
Zadig 2.9 (Build 788)
FTDI driver CDM212364_Setup
The instruction of TwoWire(1) caused error message below at the line of .beginTransmission():
[ 89][E][Wire.cpp:448] endTransmission(): NULL TX buffer pointer
The code:
void scan (void)
{
Serial.println("Scanning for I2C devices...");
for( uint8_t address = 1; address < 127; address++ )
{
_wire.beginTransmission(address);
uint8_t error = _wire.endTransmission();
if( error == 0 )
{
Serial.print("I2C device found at address 0x");
if (address < 16) Serial.print("0");
Serial.println(address, HEX);
}
}
Serial.println("I2C scan complete.");
}
However, if I specify as “TwoWire _wire = TwoWire(0);” then no error, able to detect the I2C device address.
Please advise.