first commit
This commit is contained in:
21
i2cs.py
Executable file
21
i2cs.py
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from smbus import SMBus
|
||||
import time
|
||||
bus = SMBus(1)
|
||||
slaveAddress = 0x12
|
||||
data_received_from_Arduino = ""
|
||||
data_to_send_to_Arduino = "Hello Uno"
|
||||
|
||||
|
||||
def StringToBytes(val):
|
||||
retVal = []
|
||||
for c in val:
|
||||
retVal.append(c)
|
||||
return retVal
|
||||
|
||||
bus.write_byte(slaveAddress,1)
|
||||
time.sleep(0.2)
|
||||
data_received_from_Arduino = bus.read_i2c_block_data(slaveAddress, 0, 12)
|
||||
print(data_received_from_Arduino)
|
||||
|
||||
Reference in New Issue
Block a user