Send/receive a byte via i2c
This commit is contained in:
parent
ec750e9fc1
commit
ae67e347e9
13
i2c/echo.py
Executable file
13
i2c/echo.py
Executable file
@ -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)
|
Reference in New Issue
Block a user