I2C slave does not work

Hello,

We tested the example on this page:
https://os.mbed.com/docs/mbed-os/v6.0/mbed-os-api-doxy/classmbed_1_1_i2_c_slave.html

On the terminal we keep getting
“Failed to write to slave!
Failed to read from slave!”

We made two new programs on the compiler; one for master and one for slave, and we broken down the example to master and slave. We are using I2C pins PB_7 and PB_6 for both master and slave boards. We have included resistors between the pins and 3.3V. Is the example wrong or are we doing something wrong?

Thank you,
Chris