try it , differents script I tested

Patrick

Le 06/12/2019 à 11:13, Michael a écrit :
I see the driver. It works at the moment too. I wanted to test the driver separately, because at the moment indoor and outdoor temperature equated. But I wanted to measure both separately with one BME280 each.

--
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/7e19c607-1d1c-7d27-cf5e-1ff28039bea5%40gmail.com.
import bme280
import smbus2
from time import sleep

port = 1
address = 0x76 # Adafruit BME280 address. Other BME280s may be different
bus = smbus2.SMBus(port)

bme280.load_calibration_params(bus,address)

while True:
    bme280_data = bme280.sample(bus,address)
    humidity  = bme280_data.humidity
    pressure  = bme280_data.pressure
    ambient_temperature = bme280_data.temperature
    print(humidity, pressure, ambient_temperature)
    sleep(1)
import bme280
import smbus2
from time import sleep

port = 1
address = 0x76 
bus = smbus2.SMBus(port)

bme280.load_calibration_params(bus,address)

def read_all() :
    bme280_data = bme280.sample(bus,address)
    return bme280_data.humidity, bme280_data.pressure, bme280_data.temperature
import time
import smbus2
import bme280

bus = smbus2.SMBus(1)
address = 0x76

calibration_params = bme280.load_calibration_params(bus, address)
layout = '{0:5d}:  {1},  {2:0.3f} deg C,  {3:0.2f} hPa,  {4:0.2f} %'
counter = 1

while True:
    data = bme280.sample(bus, address, calibration_params)
    print(bme280.sample(bus, 0x76))
#with open("sample.log","a+") as f:
#        f.write(layout.format(counter, data.timestamp, data.temperature, 
data.pressure, data.humidity) + "\n")
#    f.close()
    counter += 1
    time.sleep(1)

Reply via email to