16 lines
294 B
Python
16 lines
294 B
Python
|
import smbus
|
||
|
import time
|
||
|
|
||
|
bus = smbus.SMBus(1)
|
||
|
address = 0x09 # Arduino I2C Address
|
||
|
|
||
|
def get_temp(addr):
|
||
|
# request data
|
||
|
temp = (bus.read_byte(addr) - 75)
|
||
|
time.sleep(1)
|
||
|
return temp
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
print("temp of 0x09:",get_temp(address))
|