environmental_sensors.py 397 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
from sense_hat import SenseHat

sense = SenseHat()

humidity = sense.get_humidity()
temp_humidity = sense.get_temperature_from_humidity()
print("Humidity sensor : {:.2f} %rH , {:.2f} °C".format(humidity, temp_humidity))

pressure = sense.get_pressure()
temp_pressure = sense.get_temperature_from_pressure()
print("Pressure sensor : {:.2f} Millibars , {:.2f} °C".format(pressure, temp_pressure))