simple i2c bus scanner
This commit is contained in:
parent
cc5a97ffa4
commit
ec750e9fc1
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
|
||||||
|
|
Reference in New Issue
Block a user