22 lines
420 B
Python
Executable File
22 lines
420 B
Python
Executable File
#!/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)
|
|
|