fix BME280 support to actually work (now tested)
This commit is contained in:
parent
ec01ef8f15
commit
ec476cc54b
17
uPySensor.py
17
uPySensor.py
|
@ -16,7 +16,22 @@ class BME280(uPySensor):
|
||||||
self.handle = self.bme280.BME280(i2c=self.i2c)
|
self.handle = self.bme280.BME280(i2c=self.i2c)
|
||||||
|
|
||||||
def update_sensor(self):
|
def update_sensor(self):
|
||||||
self.temperature, self.pressure, self.humidity = self.handle.values()
|
t, p, h = self.handle.values
|
||||||
|
self.temperature = float(t[:-1])
|
||||||
|
self.pressure = float(p[:-3])
|
||||||
|
self.humidity = float(h[:-1])
|
||||||
|
|
||||||
|
def read_tempC(self):
|
||||||
|
self.update_sensor()
|
||||||
|
return self.temperature
|
||||||
|
|
||||||
|
def read_hum(self):
|
||||||
|
self.update_sensor()
|
||||||
|
return self.humidity
|
||||||
|
|
||||||
|
def read_pressure(self):
|
||||||
|
self.update_sensor()
|
||||||
|
return self.pressure
|
||||||
|
|
||||||
class LM75A(uPySensor):
|
class LM75A(uPySensor):
|
||||||
LM75A_ADDRESS = 0x48
|
LM75A_ADDRESS = 0x48
|
||||||
|
|
Loading…
Reference in New Issue