+ 1
Given this output, what is the key:value pair python is using
I'm trying to understand how a particular python script works and this is the output when i print 'bme280_data': compensated_reading(id=ee50df9c-3aa3-4772-8767-73b6bb74f30f, timestamp=2016-11-18 17:33:28.937863, temp=20.563 °C, pressure=980.91 hPa, humidity=48.41 % rH) when I just want the temp, I can print(bme280_data.temp) is bme280 using a dictionary to store this data? This is the code: import smbus2 import bme280 port = 1 address = 0x76 bus = smbus2.SMBus(port) bme280.load_calibration_params(bus, address) bme280_data = bme280.sample(bus, address)
4 Réponses
+ 2
Seems to be object access. For humidity you can try:
print(bme280_data.humidity)
What do you want to achieve?
+ 1
JaScript thanks for answering. Im working on a project and was just wondering how the bme280 library works and how to access the data
+ 1
Cool project David . You get a set of sensor data. They could be stored with a time delay. And then something can be done with it. Happy coding!
+ 1
I used it for the raspberry pi weather station. Has been really fun making. Just finished it today.