First sample

This commit is contained in:
James Bowman 2019-02-20 07:45:33 -08:00
parent c9398d50ee
commit 6fa539e1b8
2 changed files with 13 additions and 3 deletions

View File

@ -69,11 +69,9 @@ class I2CDriver:
if reset == "never": if reset == "never":
return return
if reset or (self.scl, self.sda) != (1, 1): if reset or (self.scl, self.sda) != (1, 1):
print('RESET')
if self.reset() != 3: if self.reset() != 3:
assert 0 assert 0, "I2C bus is busy"
self.getstatus() self.getstatus()
# self.reboot()
self.setspeed(100) self.setspeed(100)
if PYTHON2: if PYTHON2:

View File

@ -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)