Modifying I2C code from uno to Pico

So after having tried to use the mbed-core with trying to compile the classical I2C-Scanner sketch which did not compile.

I recommend that you use the Earl Philhower-core. (maybe you are already using this core)

With searching the Arduino-Forum I found this post

which has a demo-code how to use these functions

  Wire.setSDA(PICO_I2C_SDA);
  Wire.setSCL(PICO_I2C_SCL);

These functions are only declared in the Earl Philhower-core

these functions return a boolean result because not all RP2040-IO-pins can do I2C

So you can code

if(! Wire.setSDA(PICO_I2C_SDA)   ) {
  Serial.print("unable to use IO-pin "
  Serial.print(PICO_I2C_SDA);
  Serial.println(" for I2C-SDA"
};

if(! Wire.setSCL(PICO_I2C_SCL)  ) {
  Serial.print("unable to use IO-pin "
  Serial.print(PICO_I2C_SCL);
  Serial.println(" for I2C-SCL"
};

to get feedback if the pin is able to do I2C