BME280 sensor with MIND+ and python

userHead Pedro.Hepp 2024-04-25 04:05:57 246 Views3 Replies

Hi, what is the Mind+ python code to access sensor data from a BME280 sensor?

Please provide a small functional code.


Thank you very much

2024-05-26 16:07:43

TypeError: 'NoneType' object is not subscriptable” means you don't find the sensor. You need to verify that the sensor is correctly connected and Pins are properly defined.

userHeadPic Lupin
2024-04-25 15:15:30

Below is the Python sample code which could run on UNIHIKER, if that what you are looking for.



from pinpong.libs.dfrobot_bme280 import BME280

from pinpong.board import Board

import time



p_bme280 = BME280()


while True:






userHeadPic Yeez_B
Pedro.Hepp wrote:

Thank you very much Yeez_B

I tried that code before on a UNIHIKER Board and got this error message:


Traceback (most recent call last):
 File "/root/mindplus/cache/new-project-25-4-2024-8-22-4.mp/BME280.py", line 6, in <module>
   p_bme280 = BME280()
 File "/usr/local/lib/python3.7/dist-packages/pinpong/libs/dfrobot_bme280.py", line 54, in __init__
   while not self.begin():
 File "/usr/local/lib/python3.7/dist-packages/pinpong/libs/dfrobot_bme280.py", line 61, in begin
   temp = self.get_reg(chip_id)[0]
TypeError: 'NoneType' object is not subscriptable


This is line 6 causing the error:

   p_bme280 = BME280()


Is it a problem with the UNIHIKER board perhaps?

2024-04-25 20:31:45
1 Replies