BME280 sensor with MIND+ and python
![userHead](https://dfimg.dfrobot.com/dfPortrait2.png)
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
I seem to be able to read the sensor for temperature and pressure<a href="https://minimilitiamodapk.com/">.</a>
![userHeadPic](https://dfimg.dfrobot.com/dfPortrait2.png)
I seem to be able to read the sensor for temperature and pressure.
![userHeadPic](https://dfimg.dfrobot.com/dfPortrait2.png)
“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](https://dfimg.dfrobot.com/dfPortrait2.png)
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
Board().begin()
p_bme280 = BME280()
while True:
print(p_bme280.temp_c())
print(p_bme280.humidity())
print(p_bme280.cal_altitudu())
print(p_bme280.press_pa())
time.sleep(1)
![userHeadPic](https://dfimg.dfrobot.com/dfPortrait2.png)
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
root@unihiker:~/mindplus/cache/new-project-25-4-2024-8-22-4.mp#
This is line 6 causing the error:
p_bme280 = BME280()
Is it a problem with the UNIHIKER board perhaps?