From ae67e347e9b118b24c9e268fb327f41ae5f18f25 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Sun, 17 Jan 2016 20:26:23 +0100 Subject: [PATCH] Send/receive a byte via i2c --- i2c/echo.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 i2c/echo.py diff --git a/i2c/echo.py b/i2c/echo.py new file mode 100755 index 0000000..737cd67 --- /dev/null +++ b/i2c/echo.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +import smbus + +bus = smbus.SMBus(1) +address = 0x23 + +def send(data): + print 'Send / receive: ' + str(data) + ' / ' + str(bus.read_byte_data(address, data)) + + +for d in range(1, 5): + send(d)