From ec750e9fc1defa1da77f937ab7638615ddfc51ea Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Mon, 11 Jan 2016 13:01:26 +0100 Subject: [PATCH] simple i2c bus scanner --- i2c/scan.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 i2c/scan.py diff --git a/i2c/scan.py b/i2c/scan.py new file mode 100755 index 0000000..4e20fb9 --- /dev/null +++ b/i2c/scan.py @@ -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 +