please,
to see if together we can make all options expanded reading this sensor code.
Encouragement and thanks
Code: Select all
# para que funcione el I2C tengo que ejecutar desde
# la linea de comandos
# echo -n 1 > /sys/module/i2c_bcm2708/parameters/combined exit
import smbus
addr = 0x5a
x = 0x07
i2c = smbus.SMBus(1)
lreg = i2c.read_word_data(addr, x)
print "%02x: %02x %d"%(x,lreg,lreg)
#print ret
t = "%02x"%(lreg)
tb = int(t, 16)
#print "t:",t
#print "tb = int(t,16).. convertimos hex a dec .->", tb
tb = tb * 0.02
#print "si el registo 0000 es 273.15 grados lo multiplico x 0,02"
#print "tb = tb * 0.02 .-> ", tb
temp = tb - 273.15
#print "temp = tb -273.15 lo paso a centigrados", temp, "C"
print "T.-> ", temp