====== TMP102 température ====== ce capteur sur l'I2C peut aussi etre géré par sensors sous linux import time import spidev,time,liblo,sys PORTOSC=9001 IPOSC="localhost" DEVICE = 0x48 # Default device I2C address bus = smbus.SMBus(0) def readTemp(addr=DEVICE): try: data = bus.read_i2c_block_data(DEVICE, 0) msb = data[0] lsb = data[1] #result = (((msb << 8) | lsb) >> 4) * 0.0625 result = (((((msb << 8) | lsb) >> 4) * 0.0625) * 1.8) return result except IOError, err: print ("ioerr read") def main(): # ouverture port OSC try: targetOSC = liblo.Address(IPOSC,PORTOSC) except liblo.AddressError, err: print str(err) sys.exit() while True: print "Temp : " + str(readTemp()) liblo.send(targetOSC,"/TEMP1", readTemp()) time.sleep(1) if __name__=="__main__": main()