I’m incorporating an I2C display into my Boron project and have it working. I would like this display to be optional - i.e. the boron will run “headless” if the display is not attached. I also may incorporate future optional sensors via I2C. The problem I’m running into is that if the display is disconnected (or damaged) the Boron locks up completely when I try to initialize the display (Adafruit_SSD1306 library) or even scan the I2C bus.
How can I ensure that I2C operations don’t lock up the Boron, but instead return an error that I can handle in my code?
EDIT: The device lockup is not related to the Adafruit library. I tried a simple scan of the I2C bus with the display’s Vcc disconnected, and the Boron locked up on Wire.endTransmission(). Wire.begin() was of course called first, and the test works when the display has its Vcc pin attached.