Skew

List SMbus devices

Jul 2nd, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. import smbus
  2.  
  3. bus = smbus.SMBus(1)
  4.  
  5. def list_devices():
  6.     devices = []
  7.     for device in range(128):
  8.         try:
  9.             bus.read_byte(device)
  10.             devices.append(device)
  11.             print(hex(device))
  12.         except:
  13.             pass
  14.     return devices
Advertisement
Add Comment
Please, Sign In to add comment