diff --git a/docs/design_guide.rst b/docs/design_guide.rst index 26e57cf531..a3c22a086b 100644 --- a/docs/design_guide.rst +++ b/docs/design_guide.rst @@ -250,12 +250,13 @@ I2C Example from adafruit_bus_device import i2c_device + DEVICE_DEFAULT_I2C_ADDR = 0x42 + class Widget: """A generic widget.""" - def __init__(self, i2c): - # Always on address 0x40. - self.i2c_device = i2c_device.I2CDevice(i2c, 0x40) + def __init__(self, i2c, address=DEVICE_DEFAULT_I2C_ADDR): + self.i2c_device = i2c_device.I2CDevice(i2c, address) self.buf = bytearray(1) @property