simple i2c bus scanner
This commit is contained in:
parent
cc5a97ffa4
commit
ec750e9fc1
1 changed files with 13 additions and 0 deletions
13
i2c/scan.py
Executable file
13
i2c/scan.py
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import smbus
|
||||
|
||||
bus = smbus.SMBus(1)
|
||||
|
||||
for address in range(0, 127):
|
||||
try:
|
||||
bus.read_byte(address)
|
||||
print 'device at address ' + hex(address)
|
||||
except IOError:
|
||||
pass
|
||||
|
Loading…
Reference in a new issue