From Adafruit_SH1106_kbv.h:
class Adafruit_SH1106_kbv : public Adafruit_GFX {
public:
// NEW CONSTRUCTORS -- recommended for new projects
Adafruit_SH1106_kbv(uint8_t w, uint8_t h, TwoWire *twi = &Wire,
int8_t rst_pin = -1, uint32_t clkDuring = 400000UL,
uint32_t clkAfter = 100000UL);
Adafruit_SH1106_kbv(uint8_t w, uint8_t h, int8_t mosi_pin, int8_t sclk_pin,
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
Adafruit_SH1106_kbv(uint8_t w, uint8_t h, SPIClass *spi, int8_t dc_pin,
int8_t rst_pin, int8_t cs_pin, uint32_t bitrate = 8000000UL);
So you have replaced the I2C display constructor with a bit-banged SPI constructor.
Note that the Arduino Mbed OS RP2040: Raspberry Pi Pico Board expects hardware SPI and hardware I2C on:
// SPI
#define PIN_SPI_MISO (4u)
#define PIN_SPI_MOSI (3u)
#define PIN_SPI_SCK (2u)
#define PIN_SPI_SS (5u)
// Wire
#define PIN_WIRE_SDA (6u)
#define PIN_WIRE_SCL (7u)
Note that Earlphilhower and the SDK choose different GPnn pins for default SPI and I2C
I don't think that I have tried a SPI SH1106 display with hardware or bit-banged constructor. Only with I2C on GP6, GP7 pins.
Which pins did you use for I2C display ?
You can select an alternate TwoWire object.
If you have trouble with I2C display, I will try my SPI display.
David.
Edit. Tried both hardware SPI and bit-bashed on a 7-pin SH1106 display. Both worked fine.
Please let me know how you get on.