A python library for accessing the BME280 combined humidity and pressure sensor from Bosch

demo.py 280B

123456789101112
  1. #!/usr/bin/env python
  2. # -*- coding: UTF-8 -*-
  3. import bme280
  4. if __name__ == '__main__':
  5. bme = bme280.Bme280()
  6. bme.set_mode(bme280.MODE_FORCED)
  7. t, p, h = bme.get_data()
  8. print "Temperature: %f °C" % t
  9. print "Pressure: %f P" % p
  10. print "Humidity: %f %%" % h