diff --git a/python/i2cdriver.py b/python/i2cdriver.py index 4779ace..f5e1cc7 100644 --- a/python/i2cdriver.py +++ b/python/i2cdriver.py @@ -69,11 +69,9 @@ class I2CDriver: if reset == "never": return if reset or (self.scl, self.sda) != (1, 1): - print('RESET') if self.reset() != 3: - assert 0 + assert 0, "I2C bus is busy" self.getstatus() - # self.reboot() self.setspeed(100) if PYTHON2: diff --git a/python/samples/read-temperature.py b/python/samples/read-temperature.py new file mode 100644 index 0000000..8808245 --- /dev/null +++ b/python/samples/read-temperature.py @@ -0,0 +1,12 @@ +import sys +import time + +from i2cdriver import I2CDriver, LM75B + +if __name__ == '__main__': + i2 = I2CDriver(sys.argv[1]) + + d = LM75B(i2) + for i in range(100): + print(d.read()) + time.sleep(.1)