From db918da5f0624e3cc723e7def3d805755f4cffa2 Mon Sep 17 00:00:00 2001 From: Carter Nelson Date: Wed, 25 Oct 2017 17:32:00 -0700 Subject: [PATCH] updated I2C example (#371) --- docs/design_guide.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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