#!/usr/bin/env python
#-*- coding: utf-8 -*-

# python3 /home/scripts_python_tests_capteurs/BME680/itbrainpower/BME680_test.py

from time import sleep
from bme680 import *


#default settings       =>      BMx280_OSR_X1, BMx280_OSR_X1, BMx280_OSR_X1, BMx280_Mode_Forced, BMx280_StandbyTime_1000ms, BMx280_Filter_Off
bme680Begin()                                                                   #start BMx280 w. default settings


bme680SetSettings(BME680_OSRX4, BME680_OSRX4, BME680_OSRX4, BME680_Filter_2)            #set specific settings

#bme680SetGas(20, 150)                                                                  #set gas heater at 320C for 150 miliseconds


while(1):

	bme680ReadData()
	temperature = bme680GetTemperature()
	pressure = bme680GetPressure()
	humidity = bme680GetHumidity()
	print(" T =  %.2f °C" % temperature)
	print(" P = %.2f hPa" % pressure)
	print("HR =  %.2f %%" % humidity)
	
	#gas = bme680GetGas()
	#print("Gas resistence : %.2f mOhm" %gas)
	print("")

	sleep(2)
