Skip to content

Instantly share code, notes, and snippets.

@sarasantos
Created January 20, 2021 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sarasantos/3f6e6852793640b2f61896624b343579 to your computer and use it in GitHub Desktop.
Save sarasantos/3f6e6852793640b2f61896624b343579 to your computer and use it in GitHub Desktop.
from machine import Pin, I2C
from time import sleep
from bme680 import *
# ESP32 - Pin assignment
i2c = I2C(scl=Pin(22), sda=Pin(21), freq=10000)
bme = BME680_I2C(i2c=i2c)
temperatures = [0, 0, 0, 0, 0]
n = 0
while True:
print('loop')
if n >= len(temperatures):
n= 0
temperatures[n] = bme.temperature * (9 / 5) + 32
average = sum(temperatures)/len(temperatures)
n += 1
print(average)
print(temperatures)
sleep(30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment