Exemple #1
0
 def read(pin):
     _onewire.reset(Pin(pin))
     _onewire.writebyte(Pin(pin), 0xcc)  #skip rom
     _onewire.writebyte(Pin(pin), 0xbe)  #read scratchpad
     #read raw temperature
     tlo = _onewire.readbyte(Pin(pin))
     thi = _onewire.readbyte(Pin(pin))
     _onewire.reset(Pin(pin))
     #convert raw values to human eye readable
     temp = tlo + thi * 256
     if temp > 32767:
         temp = temp - 65536
     temp = temp * 0.0625
     return (temp)
Exemple #2
0
 def read(self, count):
     buf = bytearray(count)
     for i in range(count):
         buf[i] = _ow.readbyte(self.pin)
     return buf
Exemple #3
0
 def readbyte(self):
     return _ow.readbyte(self.pin)
Exemple #4
0
 def readinto(self, buf):
     for i in range(len(buf)):
         buf[i] = _ow.readbyte(self.pin)
Exemple #5
0
 def readinto(self, buf):
     for i in range(len(buf)):
         buf[i] = _ow.readbyte(self.pin)
Exemple #6
0
 def readbyte(self):
     return _ow.readbyte(self.pin)
 def read_bytes(self, count):
     buf = bytearray(count)
     for i in range(count):
         buf[i] = _ow.readbyte(self.pin)
     return buf