Commit 6ff6958a authored by Ivan Tyagov's avatar Ivan Tyagov

Ressurect example which reads real enviroment data from kbme chip using

I2C.
Still keep example which simulates same process for Wendelin tutorial.
parent eb91fc69
#!/usr/bin/python3
# simulate bme280 from https://wendelin.nexedi.com/wendelin-Tutorial.Setup.Fluentd.on.Sensor
from random import gauss as g
Pm, Ps = 760, 30
Hm, Hs = 80, 5
Tm, Ts = 20, 2
print('%.1f\t%.1f\t%.1f' % (g(Pm,Ps), g(Hm,Hs), g(Tm,Ts)))
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from bme280 import bme280
from bme280 import bme280_i2c
from bme280.bme280 import read_all
bme280_i2c.set_default_i2c_address(int("0x77", 0)) # address of sensor 0x77
bme280_i2c.set_default_bus(2) # depends on distro version
bme280.setup()
data = bme280.read_all()
print("{}\t{}\t{}".format(data.pressure, data.humidity, data.temperature))
#!/usr/bin/python3
# simulate bme280 from https://wendelin.nexedi.com/wendelin-Tutorial.Setup.Fluentd.on.Sensor
from random import gauss as g
Pm, Ps = 760, 30
Hm, Hs = 80, 5
Tm, Ts = 20, 2
print('%.1f\t%.1f\t%.1f' % (g(Pm,Ps), g(Hm,Hs), g(Tm,Ts)))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment